diff --git a/.github/workflows/test-nightly.yml b/.github/workflows/test-nightly.yml deleted file mode 100644 index 2e22c520..00000000 --- a/.github/workflows/test-nightly.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Test Main and Feature Branch Nightly -on: - schedule: - - cron: "0 4 * * *" - -env: - BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} - BW_PASSWORD: ${{ secrets.BW_PASSWORD }} - BW_USERNAME: ${{ secrets.BW_USERNAME }} - BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} - BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} - BW_NUMBER: ${{ secrets.BW_NUMBER }} - USER_NUMBER: ${{ secrets.USER_NUMBER }} - BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} - BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} - BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} - MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} - MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} - MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} - MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} - ATT_NUMBER: ${{ secrets.ATT_NUMBER }} - T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }} - VZW_NUMBER: ${{ secrets.VZW_NUMBER }} - -jobs: - test_main: - name: Test Main Branch Nightly - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] - java-version: ['8', '11'] - distribution: ['zulu', 'temurin'] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: 'main' - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: ${{ matrix.distribution }} - java-version: ${{ matrix.java-version }} - - - name: Test - run: mvn -B package --file pom.xml - - test_feature: - name: Test Feature Branch Nightly - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] - java-version: ["11", "17", "19"] - distribution: ["zulu", "temurin"] - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: 'feature/openapi-generator-sdk' - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: ${{ matrix.distribution }} - java-version: ${{ matrix.java-version }} - - - name: Test - env: - JAVA_VERSION: ${{ matrix.java-version }} - RUNNER_OS: ${{ matrix.os }} - OPERATING_SYSTEM: ${{ matrix.os }} - DISTRIBUTION: ${{ matrix.distribution }} - run: mvn -B package --file pom.xml - - notify_for_failures: - name: Notify for Failures - needs: [test_main, test_feature] - if: failure() - runs-on: ubuntu-latest - steps: - - name: Notify Slack of Failures - uses: Bandwidth/build-notify-slack-action@v1.0.0 - with: - job-status: failure - slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml deleted file mode 100644 index ce3d6b5b..00000000 --- a/.github/workflows/test-pr.yml +++ /dev/null @@ -1,72 +0,0 @@ -name: Test PR -on: - pull_request: - -env: - BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} - BW_PASSWORD: ${{ secrets.BW_PASSWORD }} - BW_USERNAME: ${{ secrets.BW_USERNAME }} - BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} - BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} - BW_NUMBER: ${{ secrets.BW_NUMBER }} - USER_NUMBER: ${{ secrets.USER_NUMBER }} - BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} - BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} - BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} - MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} - MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} - MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} - MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} - ATT_NUMBER: ${{ secrets.ATT_NUMBER }} - T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }} - VZW_NUMBER: ${{ secrets.VZW_NUMBER }} - -jobs: - test_pr_main: - name: Test PR to Main Branch - runs-on: ${{ matrix.os }} - if: github.base_ref == 'main' - strategy: - matrix: - os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] - java-version: ['8', '11'] - distribution: ['zulu', 'temurin'] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: ${{ matrix.distribution }} - java-version: ${{ matrix.java-version }} - - - name: Test - run: mvn -B package --file pom.xml - - test_feature: - name: Test PR to Feature Branch - runs-on: ${{ matrix.os }} - if: github.base_ref == 'feature/openapi-generator-sdk' - strategy: - matrix: - os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] - java-version: ["11", "17", "19"] - distribution: ["zulu", "temurin"] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: ${{ matrix.distribution }} - java-version: ${{ matrix.java-version }} - - - name: Test - env: - JAVA_VERSION: ${{ matrix.java-version }} - RUNNER_OS: ${{ matrix.os }} - OPERATING_SYSTEM: ${{ matrix.os }} - DISTRIBUTION: ${{ matrix.distribution }} - run: mvn -B package --file pom.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..106096aa --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: Test +on: + # schedule: + # - cron: "0 4 * * *" + pull_request: + branches: + - main + - feature/* + workflow_dispatch: + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-2022, windows-2019, ubuntu-20.04, ubuntu-22.04] + java-version: ["11", "17", "19"] + distribution: ["zulu", "temurin"] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: ${{ matrix.distribution }} + java-version: ${{ matrix.java-version }} + + - name: Test + env: + BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} + BW_PASSWORD: ${{ secrets.BW_PASSWORD }} + BW_USERNAME: ${{ secrets.BW_USERNAME }} + BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} + BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} + BW_NUMBER: ${{ secrets.BW_NUMBER }} + USER_NUMBER: ${{ secrets.USER_NUMBER }} + BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} + JAVA_VERSION: ${{ matrix.java-version }} + RUNNER_OS: ${{ matrix.os }} + BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN }} + BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN }} + MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} + MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} + MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} + MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} + OPERATING_SYSTEM: ${{ matrix.os }} + DISTRIBUTION: ${{ matrix.distribution }} + ATT_NUMBER: ${{ secrets.ATT_NUMBER }} + T_MOBILE_NUMBER: ${{ secrets.T_MOBILE_NUMBER }} + VZW_NUMBER: ${{ secrets.VZW_NUMBER }} + run: mvn -B package --file pom.xml + + - name: Notify Slack of Failures + uses: Bandwidth/build-notify-slack-action@v1.0.1 + if: failure() && !github.event.pull_request.draft + with: + job-status: ${{ job.status }} + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml new file mode 100644 index 00000000..8bb23e4e --- /dev/null +++ b/.github/workflows/update-sdk.yml @@ -0,0 +1,102 @@ +name: Update SDK + +on: + schedule: + - cron: "0 14 * * 2" + workflow_dispatch: + +jobs: + update-sdk: + name: Update SDK if Necessary + runs-on: ubuntu-latest + outputs: + generate: ${{ steps.compare.outputs.generate }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Combine Product Specs + uses: Bandwidth/api-specs-combine-action@v1.0.0 + with: + token: ${{ secrets.DX_GITHUB_TOKEN }} + + - name: Determine if a New SDK is Needed + id: compare + run: | + if cmp -s "bandwidth.yml" "api-specs/bandwidth.yml"; then :; else mv -f api-specs/bandwidth.yml bandwidth.yml; rm -r -f api-specs; echo "generate=true" >> $GITHUB_OUTPUT; fi + + - name: Create JIRA Card for SDK Update + if: ${{ steps.compare.outputs.generate == 'true' }} + id: jira + run: | + JIRA_KEY=$(jq -r '.key' <<< $(curl -s -u $JIRA_USERNAME:$JIRA_TOKEN \ + -X POST https://bandwidth-jira.atlassian.net/rest/api/2/issue \ + -H "Content-Type: application/json" \ + --data-binary @- << EOF + { + "fields": { + "project": { + "key": "SWI" + }, + "summary": "[$LANGUAGE] Update SDK for New Spec Version", + "description": "Prepare the $LANGUAGE SDK for release based on the latest spec changes.", + "issuetype": { + "name": "Story" + }, + "customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.", + "customfield_10205": "$EPIC", + "components": [{ + "name": "Client SDKs" + }] + } + } + EOF + )) + echo "jira-key=$JIRA_KEY" >> $GITHUB_OUTPUT + env: + LANGUAGE: Java + EPIC: SWI-1876 + JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} + JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} + + - name: Build SDK + id: build + if: ${{ startsWith(steps.jira.outputs.jira-key, 'SWI') }} + uses: Bandwidth/generate-sdk-action@v3.0.0 + with: + branch-name: ${{ steps.jira.outputs.jira-key }} + token: ${{ secrets.DX_GITHUB_TOKEN }} + openapi-generator-version: 7.0.0 + language: java + config: ./openapi-config.yml + + - name: Setup Java + if: steps.build.outputs.changes + uses: actions/setup-java@v3 + with: + java-version: 17 + + - name: Clean SDK + if: steps.build.outputs.changes + run: | + mvn clean + + - name: Open Pull Request + if: steps.build.outputs.changes + run: | + gh pr create -B main -H Bandwidth:${{ steps.jira.outputs.jira-key }} -t '${{ steps.jira.outputs.jira-key }} Update SDK Based on Recent Spec Changes' -b 'Auto-generated by Update SDK Workflow' + env: + GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} + + notify_for_failures: + name: Notify for Failures + needs: [update-sdk] + if: failure() + runs-on: ubuntu-latest + steps: + - name: Notify Slack of Failures + uses: Bandwidth/build-notify-slack-action@v1.0.0 + with: + job-status: failure + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/.gitignore b/.gitignore index fdc641b1..a0826267 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,24 @@ -#macOS system files -.DS_Store +*.class -#IntelliJ IDE files -.idea -target +# Mobile Tools for Java (J2ME) +.mtj.tmp/ -#Eclipse IDE files -.classpath -.project +# Package Files # +*.jar +*.war +*.ear -*.iml -*.class +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar -tempsettings.xml -*.bin -*.lock -*.properties -*.prefs -.vscode/settings.json +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build + +.DS_Store +.idea diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 00000000..39f9dba2 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,28 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +pom.xml +.idea +.gitignore +.github/workflows/maven.yml + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 00000000..1bb1699e --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,225 @@ +.github/workflows/maven.yml +.gitignore +.travis.yml +README.md +api/openapi.yaml +build.gradle +build.sbt +docs/AccountStatistics.md +docs/AnswerCallback.md +docs/BridgeCompleteCallback.md +docs/BridgeTargetCompleteCallback.md +docs/CallDirectionEnum.md +docs/CallRecordingMetadata.md +docs/CallState.md +docs/CallStateEnum.md +docs/CallbackMethodEnum.md +docs/CallsApi.md +docs/CodeRequest.md +docs/Conference.md +docs/ConferenceCompletedCallback.md +docs/ConferenceCreatedCallback.md +docs/ConferenceMember.md +docs/ConferenceMemberExitCallback.md +docs/ConferenceMemberJoinCallback.md +docs/ConferenceRecordingAvailableCallback.md +docs/ConferenceRecordingMetadata.md +docs/ConferenceRedirectCallback.md +docs/ConferenceStateEnum.md +docs/ConferencesApi.md +docs/CreateCall.md +docs/CreateCallResponse.md +docs/CreateLookupResponse.md +docs/CreateMessageRequestError.md +docs/DeferredResult.md +docs/DisconnectCallback.md +docs/Diversion.md +docs/DtmfCallback.md +docs/FieldError.md +docs/FileFormatEnum.md +docs/GatherCallback.md +docs/InboundMessageCallback.md +docs/InboundMessageCallbackMessage.md +docs/InitiateCallback.md +docs/ListMessageDirectionEnum.md +docs/ListMessageItem.md +docs/LookupRequest.md +docs/LookupResult.md +docs/LookupStatus.md +docs/LookupStatusEnum.md +docs/MachineDetectionCompleteCallback.md +docs/MachineDetectionConfiguration.md +docs/MachineDetectionModeEnum.md +docs/MachineDetectionResult.md +docs/Media.md +docs/MediaApi.md +docs/Message.md +docs/MessageDeliveredCallback.md +docs/MessageDeliveredCallbackMessage.md +docs/MessageDirectionEnum.md +docs/MessageFailedCallback.md +docs/MessageFailedCallbackMessage.md +docs/MessageRequest.md +docs/MessageSendingCallback.md +docs/MessageSendingCallbackMessage.md +docs/MessageStatusEnum.md +docs/MessageTypeEnum.md +docs/MessagesApi.md +docs/MessagesList.md +docs/MessagingCodeResponse.md +docs/MessagingRequestError.md +docs/MfaApi.md +docs/MfaForbiddenRequestError.md +docs/MfaRequestError.md +docs/MfaUnauthorizedRequestError.md +docs/PageInfo.md +docs/PhoneNumberLookupApi.md +docs/PriorityEnum.md +docs/RecordingAvailableCallback.md +docs/RecordingCompleteCallback.md +docs/RecordingStateEnum.md +docs/RecordingsApi.md +docs/RedirectCallback.md +docs/RedirectMethodEnum.md +docs/StatisticsApi.md +docs/StirShaken.md +docs/Tag.md +docs/TnLookupRequestError.md +docs/TranscribeRecording.md +docs/Transcription.md +docs/TranscriptionAvailableCallback.md +docs/TranscriptionList.md +docs/TranscriptionMetadata.md +docs/TransferAnswerCallback.md +docs/TransferCompleteCallback.md +docs/TransferDisconnectCallback.md +docs/UpdateCall.md +docs/UpdateCallRecording.md +docs/UpdateConference.md +docs/UpdateConferenceMember.md +docs/VerifyCodeRequest.md +docs/VerifyCodeResponse.md +docs/VoiceApiError.md +docs/VoiceCodeResponse.md +git_push.sh +gradle.properties +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle +src/main/AndroidManifest.xml +src/main/java/com/bandwidth/sdk/ApiCallback.java +src/main/java/com/bandwidth/sdk/ApiClient.java +src/main/java/com/bandwidth/sdk/ApiException.java +src/main/java/com/bandwidth/sdk/ApiResponse.java +src/main/java/com/bandwidth/sdk/Configuration.java +src/main/java/com/bandwidth/sdk/GzipRequestInterceptor.java +src/main/java/com/bandwidth/sdk/JSON.java +src/main/java/com/bandwidth/sdk/Pair.java +src/main/java/com/bandwidth/sdk/ProgressRequestBody.java +src/main/java/com/bandwidth/sdk/ProgressResponseBody.java +src/main/java/com/bandwidth/sdk/ServerConfiguration.java +src/main/java/com/bandwidth/sdk/ServerVariable.java +src/main/java/com/bandwidth/sdk/StringUtil.java +src/main/java/com/bandwidth/sdk/api/CallsApi.java +src/main/java/com/bandwidth/sdk/api/ConferencesApi.java +src/main/java/com/bandwidth/sdk/api/MediaApi.java +src/main/java/com/bandwidth/sdk/api/MessagesApi.java +src/main/java/com/bandwidth/sdk/api/MfaApi.java +src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java +src/main/java/com/bandwidth/sdk/api/RecordingsApi.java +src/main/java/com/bandwidth/sdk/api/StatisticsApi.java +src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java +src/main/java/com/bandwidth/sdk/auth/Authentication.java +src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java +src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java +src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java +src/main/java/com/bandwidth/sdk/model/AccountStatistics.java +src/main/java/com/bandwidth/sdk/model/AnswerCallback.java +src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java +src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java +src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java +src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java +src/main/java/com/bandwidth/sdk/model/CallState.java +src/main/java/com/bandwidth/sdk/model/CallStateEnum.java +src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java +src/main/java/com/bandwidth/sdk/model/CodeRequest.java +src/main/java/com/bandwidth/sdk/model/Conference.java +src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceMember.java +src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java +src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java +src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java +src/main/java/com/bandwidth/sdk/model/CreateCall.java +src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java +src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java +src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java +src/main/java/com/bandwidth/sdk/model/DeferredResult.java +src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java +src/main/java/com/bandwidth/sdk/model/Diversion.java +src/main/java/com/bandwidth/sdk/model/DtmfCallback.java +src/main/java/com/bandwidth/sdk/model/FieldError.java +src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java +src/main/java/com/bandwidth/sdk/model/GatherCallback.java +src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java +src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/InitiateCallback.java +src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java +src/main/java/com/bandwidth/sdk/model/ListMessageItem.java +src/main/java/com/bandwidth/sdk/model/LookupRequest.java +src/main/java/com/bandwidth/sdk/model/LookupResult.java +src/main/java/com/bandwidth/sdk/model/LookupStatus.java +src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java +src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java +src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java +src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java +src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java +src/main/java/com/bandwidth/sdk/model/Media.java +src/main/java/com/bandwidth/sdk/model/Message.java +src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java +src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java +src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java +src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/MessageRequest.java +src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java +src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java +src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java +src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java +src/main/java/com/bandwidth/sdk/model/MessagesList.java +src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java +src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java +src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java +src/main/java/com/bandwidth/sdk/model/MfaRequestError.java +src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java +src/main/java/com/bandwidth/sdk/model/PageInfo.java +src/main/java/com/bandwidth/sdk/model/PriorityEnum.java +src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java +src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java +src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java +src/main/java/com/bandwidth/sdk/model/RedirectCallback.java +src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java +src/main/java/com/bandwidth/sdk/model/StirShaken.java +src/main/java/com/bandwidth/sdk/model/Tag.java +src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java +src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java +src/main/java/com/bandwidth/sdk/model/Transcription.java +src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java +src/main/java/com/bandwidth/sdk/model/TranscriptionList.java +src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java +src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java +src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java +src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java +src/main/java/com/bandwidth/sdk/model/UpdateCall.java +src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java +src/main/java/com/bandwidth/sdk/model/UpdateConference.java +src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java +src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java +src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java +src/main/java/com/bandwidth/sdk/model/VoiceApiError.java +src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 00000000..41225218 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.0.0 \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 95e6598f..718da910 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,576 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 +enableParallelJavaIndexSearch=true +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= +org.eclipse.jdt.core.circularClasspath=warning +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.camelCaseMatch=enabled +org.eclipse.jdt.core.codeComplete.deprecationCheck=disabled +org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck=disabled +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.forbiddenReferenceCheck=enabled +org.eclipse.jdt.core.codeComplete.forceImplicitQualification=disabled +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.codeComplete.subwordMatch=disabled +org.eclipse.jdt.core.codeComplete.suggestStaticImports=enabled +org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.lambda.genericSignature=do not generate +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.shareCommonFinallyBlocks=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.emulateJavacBug8031744=enabled +org.eclipse.jdt.core.compiler.generateClassFiles=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement=disabled +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.5 \ No newline at end of file +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.tasks=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=enabled +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.compiler.storeAnnotations=disabled +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX +org.eclipse.jdt.core.computeJavaBuildOrder=ignore +org.eclipse.jdt.core.encoding=utf8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=true +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assertion_message=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=16 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_record_components=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=20 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_annotations=0 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.text_block_indentation=0 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter +org.eclipse.jdt.core.timeoutForParameterNameFromAttachedJavadoc=50 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1b6741c0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +# +# Generated by OpenAPI Generator: https://openapi-generator.tech +# +# Ref: https://docs.travis-ci.com/user/languages/java/ +# +language: java +jdk: + - openjdk12 + - openjdk11 + - openjdk10 + - openjdk9 + - openjdk8 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + #- mvn test + # test using gradle + - gradle test + # test using sbt + # - sbt test diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7721ac5a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic", + "java.compile.nullAnalysis.mode": "automatic" +} diff --git a/README.md b/README.md index da53ceb3..35d2d99a 100644 --- a/README.md +++ b/README.md @@ -1,177 +1,272 @@ -# Bandwidth Java SDK - -[![Test](https://github.com/Bandwidth/java-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/Bandwidth/java-sdk/actions/workflows/test.yml) - -| **OS** | **Java** | **Distribution** | -|:---:|:---:|:---:| -| Windows 2016 | 8, 11 | Zulu OpenJDK, Eclipse Temurin | -| Windows 2019 | 8, 11 | Zulu OpenJDK, Eclipse Temurin | -| Ubuntu 20.04 | 8, 11 | Zulu OpenJDK, Eclipse Temurin | -| Ubuntu 22.04 | 8, 11 | Zulu OpenJDK, Eclipse Temurin | -## Getting Started - -### Installation - -Add the following dependency to your `pom.xml` file - -```xml - - - - com.bandwidth.sdk - bandwidth-sdk - {version} - - -``` - -### Initialize - -```java - -BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials("username", "password") - .voiceBasicAuthCredentials("username", "password") - .twoFactorAuthBasicAuthCredentials("username", "password") - .webRtcBasicAuthCredentials("username", "password") - .build(); -String accountId = "12345"; - -``` - -### Create A Phone Call - -```java - -com.bandwidth.voice.controllers.APIController voiceController = client.getVoiceClient().getAPIController(); - -String to = "+15554443333"; -String from = "+15553334444"; -String applicationId = "3-a-b-c"; -String answerUrl = "https://sample.com"; - -ApiCreateCallRequest body = new ApiCreateCallRequest(); -body.setTo(to); -body.setFrom(from); -body.setApplicationId(applicationId); -body.setAnswerUrl(answerUrl); - -ApiResponse createCallResponse = voiceController.createCall(accountId, body); -System.out.println(createCallResponse.getResult().getCallId()); - -``` - -### Send A Text Message - -```java - -String to = "+15554443333"; -ArrayList toNumbers = new ArrayList(); -toNumbers.add(to); -String from = "+15553334444"; -String applicationId = "3-a-b-d"; -String text = "Hello from Java"; - -MessageRequest body = new MessageRequest(); -body.setTo(toNumbers); -body.setFrom(from); -body.setText(text); -body.setApplicationId(applicationId); - -ApiResponse createMessageResponse = messagingController.createMessage(accountId, body); -System.out.println(createMessageResponse.getResult().getMessageId()); - -``` - -### Create BXML - -```java - -SpeakSentence speakSentence = SpeakSentence.builder() - .text("Hello world") - .voice("susan") - .gender("female") - .locale("en_US") - .build(); - -String response = new Response() - .add(speakSentence) - .toBXML(); -System.out.println(response); - -``` - -### Create A MFA Request - -```java - -String to = "+15554443333"; -String from = "+15553334444"; -String applicationId = "3-a-c-b"); -String scope = "scope"; -int digits = 6; -String message = "Your temporary {NAME} {SCOPE} code is {CODE}"; - -TwoFactorCodeRequestSchema body = new TwoFactorCodeRequestSchema(); -body.setTo(to); -body.setFrom(from); -body.setApplicationId(applicationId); -body.setScope(scope); -body.setDigits(digits); -body.setMessage(message); - -mfaController.createVoiceTwoFactor(accountId, body); - -String code = "123456"; //this is the user code to verify -int expirationTimeInMinutes = 3; - -TwoFactorVerifyRequestSchema body = new TwoFactorVerifyRequestSchema(); -body.setTo(to); -body.setApplicationId(applicationId); -body.setScope(scope); -body.setCode(code); -body.setExpirationTimeInMinutes(expirationTimeInMinutes); - -ApiResponse response = mfaController.createVerifyTwoFactor(accountId, body); -System.out.println(response.getResult().getValid()); - -``` - -### WebRtc Participant & Session Management - -```java - -Session createSessionBody = new Session(); -createSessionBody.setTag("new-session"); - -ApiResponse createSessionResponse = webrtcController.createSession(accountId, createSessionBody); -String sessionId = createSessionResponse.getResult().getId(); - -Participant createParticipantBody = new Participant(); -createParticipantBody.setCallbackUrl("https://sample.com"); -ArrayList publishPermissions = new ArrayList(); -publishPermissions.add(PublishPermissionEnum.AUDIO); -publishPermissions.add(PublishPermissionEnum.VIDEO); - -ApiResponse createParticipantResponse = webrtcController.createParticipant(accountId, createParticipantBody); -String participantId = createParticipantResponse.getResult().getParticipant().getId(); - -List participantSubscriptions = new ArrayList<>(); -participantSubscriptions.add(new ParticipantSubscription(participantId)); - -webrtcController.addParticipantToSession(accountId, sessionId, participantId, new Subscriptions(sessionId, participantSubscriptions)); - -``` - -## Supported Java Versions - -This package can be used with Java >= 1.8 - -## Documentation - -Documentation for this package can be found at https://dev.bandwidth.com/sdks/java - -## Credentials - -Information for credentials for this package can be found at https://dev.bandwidth.com/guides/accountCredentials.html - +# bandwidth-sdk + +Bandwidth +- API version: 1.0.0 + - Build date: 2023-08-29T14:24:34.966664-04:00[America/New_York] + +Bandwidth's Communication APIs + + For more information, please visit [https://dev.bandwidth.com](https://dev.bandwidth.com) + +*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)* + + +## Requirements + +Building the API client library requires: +1. Java 1.8+ +2. Maven (3.8.3+)/Gradle (7.2+) + +## Installation + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn clean install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn clean deploy +``` + +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. + +### Maven users + +Add this dependency to your project's POM: + +```xml + + com.bandwidth.sdk + bandwidth-sdk + 9.0.0 + compile + +``` + +### Gradle users + +Add this dependency to your project's build file: + +```groovy + repositories { + mavenCentral() // Needed if the 'bandwidth-sdk' jar has been published to maven central. + mavenLocal() // Needed if the 'bandwidth-sdk' jar has been published to the local maven repo. + } + + dependencies { + implementation "com.bandwidth.sdk:bandwidth-sdk:9.0.0" + } +``` + +### Others + +At first generate the JAR by executing: + +```shell +mvn clean package +``` + +Then manually install the following JARs: + +* `target/bandwidth-sdk-9.0.0.jar` +* `target/lib/*.jar` + +## Getting Started + +Please follow the [installation](#installation) instruction and execute the following Java code: + +```java + +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.CallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CreateCall createCall = new CreateCall(); // CreateCall | JSON object containing information to create an outbound call + try { + CreateCallResponse result = apiInstance.createCall(accountId, createCall); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#createCall"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*CallsApi* | [**createCall**](docs/CallsApi.md#createCall) | **POST** /accounts/{accountId}/calls | Create Call +*CallsApi* | [**getCallState**](docs/CallsApi.md#getCallState) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information +*CallsApi* | [**updateCall**](docs/CallsApi.md#updateCall) | **POST** /accounts/{accountId}/calls/{callId} | Update Call +*CallsApi* | [**updateCallBxml**](docs/CallsApi.md#updateCallBxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML +*ConferencesApi* | [**downloadConferenceRecording**](docs/ConferencesApi.md#downloadConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording +*ConferencesApi* | [**getConference**](docs/ConferencesApi.md#getConference) | **GET** /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information +*ConferencesApi* | [**getConferenceMember**](docs/ConferencesApi.md#getConferenceMember) | **GET** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member +*ConferencesApi* | [**getConferenceRecording**](docs/ConferencesApi.md#getConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information +*ConferencesApi* | [**listConferenceRecordings**](docs/ConferencesApi.md#listConferenceRecordings) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings +*ConferencesApi* | [**listConferences**](docs/ConferencesApi.md#listConferences) | **GET** /accounts/{accountId}/conferences | Get Conferences +*ConferencesApi* | [**updateConference**](docs/ConferencesApi.md#updateConference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference +*ConferencesApi* | [**updateConferenceBxml**](docs/ConferencesApi.md#updateConferenceBxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML +*ConferencesApi* | [**updateConferenceMember**](docs/ConferencesApi.md#updateConferenceMember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member +*MediaApi* | [**deleteMedia**](docs/MediaApi.md#deleteMedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media +*MediaApi* | [**getMedia**](docs/MediaApi.md#getMedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media +*MediaApi* | [**listMedia**](docs/MediaApi.md#listMedia) | **GET** /users/{accountId}/media | List Media +*MediaApi* | [**uploadMedia**](docs/MediaApi.md#uploadMedia) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media +*MessagesApi* | [**createMessage**](docs/MessagesApi.md#createMessage) | **POST** /users/{accountId}/messages | Create Message +*MessagesApi* | [**listMessages**](docs/MessagesApi.md#listMessages) | **GET** /users/{accountId}/messages | List Messages +*MfaApi* | [**generateMessagingCode**](docs/MfaApi.md#generateMessagingCode) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code +*MfaApi* | [**generateVoiceCode**](docs/MfaApi.md#generateVoiceCode) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code +*MfaApi* | [**verifyCode**](docs/MfaApi.md#verifyCode) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code +*PhoneNumberLookupApi* | [**createLookup**](docs/PhoneNumberLookupApi.md#createLookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup +*PhoneNumberLookupApi* | [**getLookupStatus**](docs/PhoneNumberLookupApi.md#getLookupStatus) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status +*RecordingsApi* | [**deleteCallTranscription**](docs/RecordingsApi.md#deleteCallTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription +*RecordingsApi* | [**deleteRecording**](docs/RecordingsApi.md#deleteRecording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording +*RecordingsApi* | [**deleteRecordingMedia**](docs/RecordingsApi.md#deleteRecordingMedia) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media +*RecordingsApi* | [**downloadCallRecording**](docs/RecordingsApi.md#downloadCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording +*RecordingsApi* | [**getCallRecording**](docs/RecordingsApi.md#getCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording +*RecordingsApi* | [**getCallTranscription**](docs/RecordingsApi.md#getCallTranscription) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription +*RecordingsApi* | [**listAccountCallRecordings**](docs/RecordingsApi.md#listAccountCallRecordings) | **GET** /accounts/{accountId}/recordings | Get Call Recordings +*RecordingsApi* | [**listCallRecordings**](docs/RecordingsApi.md#listCallRecordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings +*RecordingsApi* | [**transcribeCallRecording**](docs/RecordingsApi.md#transcribeCallRecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request +*RecordingsApi* | [**updateCallRecordingState**](docs/RecordingsApi.md#updateCallRecordingState) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording +*StatisticsApi* | [**getStatistics**](docs/StatisticsApi.md#getStatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics + + +## Documentation for Models + + - [AccountStatistics](docs/AccountStatistics.md) + - [AnswerCallback](docs/AnswerCallback.md) + - [BridgeCompleteCallback](docs/BridgeCompleteCallback.md) + - [BridgeTargetCompleteCallback](docs/BridgeTargetCompleteCallback.md) + - [CallDirectionEnum](docs/CallDirectionEnum.md) + - [CallRecordingMetadata](docs/CallRecordingMetadata.md) + - [CallState](docs/CallState.md) + - [CallStateEnum](docs/CallStateEnum.md) + - [CallbackMethodEnum](docs/CallbackMethodEnum.md) + - [CodeRequest](docs/CodeRequest.md) + - [Conference](docs/Conference.md) + - [ConferenceCompletedCallback](docs/ConferenceCompletedCallback.md) + - [ConferenceCreatedCallback](docs/ConferenceCreatedCallback.md) + - [ConferenceMember](docs/ConferenceMember.md) + - [ConferenceMemberExitCallback](docs/ConferenceMemberExitCallback.md) + - [ConferenceMemberJoinCallback](docs/ConferenceMemberJoinCallback.md) + - [ConferenceRecordingAvailableCallback](docs/ConferenceRecordingAvailableCallback.md) + - [ConferenceRecordingMetadata](docs/ConferenceRecordingMetadata.md) + - [ConferenceRedirectCallback](docs/ConferenceRedirectCallback.md) + - [ConferenceStateEnum](docs/ConferenceStateEnum.md) + - [CreateCall](docs/CreateCall.md) + - [CreateCallResponse](docs/CreateCallResponse.md) + - [CreateLookupResponse](docs/CreateLookupResponse.md) + - [CreateMessageRequestError](docs/CreateMessageRequestError.md) + - [DeferredResult](docs/DeferredResult.md) + - [DisconnectCallback](docs/DisconnectCallback.md) + - [Diversion](docs/Diversion.md) + - [DtmfCallback](docs/DtmfCallback.md) + - [FieldError](docs/FieldError.md) + - [FileFormatEnum](docs/FileFormatEnum.md) + - [GatherCallback](docs/GatherCallback.md) + - [InboundMessageCallback](docs/InboundMessageCallback.md) + - [InboundMessageCallbackMessage](docs/InboundMessageCallbackMessage.md) + - [InitiateCallback](docs/InitiateCallback.md) + - [ListMessageDirectionEnum](docs/ListMessageDirectionEnum.md) + - [ListMessageItem](docs/ListMessageItem.md) + - [LookupRequest](docs/LookupRequest.md) + - [LookupResult](docs/LookupResult.md) + - [LookupStatus](docs/LookupStatus.md) + - [LookupStatusEnum](docs/LookupStatusEnum.md) + - [MachineDetectionCompleteCallback](docs/MachineDetectionCompleteCallback.md) + - [MachineDetectionConfiguration](docs/MachineDetectionConfiguration.md) + - [MachineDetectionModeEnum](docs/MachineDetectionModeEnum.md) + - [MachineDetectionResult](docs/MachineDetectionResult.md) + - [Media](docs/Media.md) + - [Message](docs/Message.md) + - [MessageDeliveredCallback](docs/MessageDeliveredCallback.md) + - [MessageDeliveredCallbackMessage](docs/MessageDeliveredCallbackMessage.md) + - [MessageDirectionEnum](docs/MessageDirectionEnum.md) + - [MessageFailedCallback](docs/MessageFailedCallback.md) + - [MessageFailedCallbackMessage](docs/MessageFailedCallbackMessage.md) + - [MessageRequest](docs/MessageRequest.md) + - [MessageSendingCallback](docs/MessageSendingCallback.md) + - [MessageSendingCallbackMessage](docs/MessageSendingCallbackMessage.md) + - [MessageStatusEnum](docs/MessageStatusEnum.md) + - [MessageTypeEnum](docs/MessageTypeEnum.md) + - [MessagesList](docs/MessagesList.md) + - [MessagingCodeResponse](docs/MessagingCodeResponse.md) + - [MessagingRequestError](docs/MessagingRequestError.md) + - [MfaForbiddenRequestError](docs/MfaForbiddenRequestError.md) + - [MfaRequestError](docs/MfaRequestError.md) + - [MfaUnauthorizedRequestError](docs/MfaUnauthorizedRequestError.md) + - [PageInfo](docs/PageInfo.md) + - [PriorityEnum](docs/PriorityEnum.md) + - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) + - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) + - [RecordingStateEnum](docs/RecordingStateEnum.md) + - [RedirectCallback](docs/RedirectCallback.md) + - [RedirectMethodEnum](docs/RedirectMethodEnum.md) + - [StirShaken](docs/StirShaken.md) + - [Tag](docs/Tag.md) + - [TnLookupRequestError](docs/TnLookupRequestError.md) + - [TranscribeRecording](docs/TranscribeRecording.md) + - [Transcription](docs/Transcription.md) + - [TranscriptionAvailableCallback](docs/TranscriptionAvailableCallback.md) + - [TranscriptionList](docs/TranscriptionList.md) + - [TranscriptionMetadata](docs/TranscriptionMetadata.md) + - [TransferAnswerCallback](docs/TransferAnswerCallback.md) + - [TransferCompleteCallback](docs/TransferCompleteCallback.md) + - [TransferDisconnectCallback](docs/TransferDisconnectCallback.md) + - [UpdateCall](docs/UpdateCall.md) + - [UpdateCallRecording](docs/UpdateCallRecording.md) + - [UpdateConference](docs/UpdateConference.md) + - [UpdateConferenceMember](docs/UpdateConferenceMember.md) + - [VerifyCodeRequest](docs/VerifyCodeRequest.md) + - [VerifyCodeResponse](docs/VerifyCodeResponse.md) + - [VoiceApiError](docs/VoiceApiError.md) + - [VoiceCodeResponse](docs/VoiceCodeResponse.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### Basic + +- **Type**: HTTP basic authentication + + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + +letstalk@bandwidth.com + diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 00000000..5f777470 --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,9610 @@ +openapi: 3.0.3 +info: + contact: + email: letstalk@bandwidth.com + name: Bandwidth + url: https://dev.bandwidth.com + description: Bandwidth's Communication APIs + title: Bandwidth + version: 1.0.0 +servers: +- url: / +security: +- Basic: [] +tags: +- name: Messages +- name: Media +- name: Calls +- name: Conferences +- name: Recordings +- name: Statistics +- name: MFA +- name: Phone Number Lookup +paths: + /users/{accountId}/media: + get: + description: Gets a list of your media files. No query parameters are supported. + operationId: listMedia + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Continuation token used to retrieve subsequent media. + example: 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39 + explode: false + in: header + name: Continuation-Token + required: false + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/media' + type: array + description: OK + headers: + Continuation-Token: + description: Continuation token used to retrieve subsequent media. + explode: false + schema: + type: string + style: simple + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "406": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: List Media + tags: + - Media + x-accepts: application/json + servers: + - description: Production + url: https://messaging.bandwidth.com/api/v2 + /users/{accountId}/media/{mediaId}: + delete: + description: |- + Deletes a media file from Bandwidth API server. Make sure you don't have + any application scripts still using the media before you delete. + + If you accidentally delete a media file you can immediately upload a new + file with the same name. + operationId: deleteMedia + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Media ID to retrieve. + example: 14762070468292kw2fuqty55yp2b2/0/bw.png + explode: false + in: path + name: mediaId + required: true + schema: + type: string + style: simple + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "406": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: Delete Media + tags: + - Media + x-accepts: application/json + get: + description: Downloads a media file you previously uploaded. + operationId: getMedia + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Media ID to retrieve. + example: 14762070468292kw2fuqty55yp2b2/0/bw.png + explode: false + in: path + name: mediaId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/octet-stream: + schema: + description: Successful Operation + format: binary + type: string + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "406": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: Get Media + tags: + - Media + x-accepts: application/json + put: + description: |- + Upload a file. You may add headers to the request in order to provide some control to your media file. + + If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. + + A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + operationId: uploadMedia + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Media ID to retrieve. + example: 14762070468292kw2fuqty55yp2b2/0/bw.png + explode: false + in: path + name: mediaId + required: true + schema: + type: string + style: simple + - description: The media type of the entity-body. + example: audio/wav + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + - description: General-header field is used to specify directives that MUST + be obeyed by all caching mechanisms along the request/response chain. + example: no-cache + explode: false + in: header + name: Cache-Control + required: false + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/uploadMediaRequest' + responses: + "204": + description: No Content + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "406": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: Upload Media + tags: + - Media + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://messaging.bandwidth.com/api/v2 + /users/{accountId}/messages: + get: + description: Returns a list of messages based on query parameters. + operationId: listMessages + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: "The ID of the message to search for. Special characters need\ + \ to be encoded using URL encoding. Message IDs could come in different\ + \ formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ + \ are valid message ID formats. Note that you must include at least one\ + \ query parameter." + example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + explode: true + in: query + name: messageId + required: false + schema: + type: string + style: form + - description: "The phone number that sent the message. Accepted values are:\ + \ a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." + example: '%2B15554443333' + explode: true + in: query + name: sourceTn + required: false + schema: + type: string + style: form + - description: "The phone number that received the message. Accepted values\ + \ are: a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." + example: '%2B15554443333' + explode: true + in: query + name: destinationTn + required: false + schema: + type: string + style: form + - description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. + explode: true + in: query + name: messageStatus + required: false + schema: + $ref: '#/components/schemas/messageStatusEnum' + style: form + - description: The direction of the message. One of INBOUND OUTBOUND. + explode: true + in: query + name: messageDirection + required: false + schema: + $ref: '#/components/schemas/listMessageDirectionEnum' + style: form + - description: The name of the carrier used for this message. Possible values + include but are not limited to Verizon and TMobile. Special characters need + to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + example: Verizon + explode: true + in: query + name: carrierName + required: false + schema: + type: string + style: form + - description: The type of message. Either sms or mms. + explode: true + in: query + name: messageType + required: false + schema: + $ref: '#/components/schemas/messageTypeEnum' + style: form + - description: The error code of the message. + example: 9902 + explode: true + in: query + name: errorCode + required: false + schema: + type: integer + style: form + - description: The start of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + explode: true + in: query + name: fromDateTime + required: false + schema: + type: string + style: form + - description: The end of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + explode: true + in: query + name: toDateTime + required: false + schema: + type: string + style: form + - description: The campaign ID of the message. + example: CJEUMDK + explode: true + in: query + name: campaignId + required: false + schema: + type: string + style: form + - description: The field and direction to sort by combined with a colon. Direction + is either asc or desc. + example: sourceTn:desc + explode: true + in: query + name: sort + required: false + schema: + type: string + style: form + - description: A base64 encoded value used for pagination of results. + example: gdEewhcJLQRB5 + explode: true + in: query + name: pageToken + required: false + schema: + type: string + style: form + - description: The maximum records requested in search result. Default 100. + The sum of limit and after cannot be more than 10000. + example: 50 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + - description: "When set to true, the response's totalCount field will have\ + \ a maximum value of 10,000. When set to false, or excluded, this will give\ + \ an accurate totalCount of all messages that match the provided filters.\ + \ If you are experiencing latency, try using this parameter to limit your\ + \ results." + example: true + explode: true + in: query + name: limitTotalCount + required: false + schema: + type: boolean + style: form + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/messagesList' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: List Messages + tags: + - Messages + x-accepts: application/json + post: + callbacks: + inboundCallback: + $ref: '#/components/callbacks/inboundCallback' + statusCallback: + $ref: '#/components/callbacks/statusCallback' + description: Endpoint for sending text messages and picture messages using V2 + messaging. + operationId: createMessage + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/createMessageRequest' + responses: + "202": + content: + application/json: + schema: + $ref: '#/components/schemas/message' + description: Accepted + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/createMessageRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + "404": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + "406": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + "415": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + summary: Create Message + tags: + - Messages + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://messaging.bandwidth.com/api/v2 + /accounts/{accountId}/calls: + post: + description: |- + Creates an outbound phone call. + + All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to "fire and forget" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. + + Please note: Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + operationId: createCall + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/createCallRequest' + responses: + "201": + content: + application/json: + examples: + createCall Response: + $ref: '#/components/examples/createCallResponseExample' + schema: + $ref: '#/components/schemas/createCallResponse' + description: Call Successfully Created + headers: + Location: + description: The URL for further interactions with this call + explode: false + schema: + type: string + style: simple + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Create Call + tags: + - Calls + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}: + get: + description: |- + Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. + + **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. + operationId: getCallState + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/callState' + description: Call found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Call State Information + tags: + - Calls + x-accepts: application/json + post: + description: Interrupts and redirects a call to a different URL that should + return a BXML document. + operationId: updateCall + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateCallRequest' + responses: + "200": + description: Call was successfully modified. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "409": + content: + application/json: + examples: + conflictErrorExample: + $ref: '#/components/examples/voiceConflictErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Conflict + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Call + tags: + - Calls + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/bxml: + put: + description: Interrupts and replaces an active call's BXML document. + operationId: updateCallBxml + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateCallBxmlRequest' + responses: + "204": + description: Call BXML was successfully replaced. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "409": + content: + application/json: + examples: + conflictErrorExample: + $ref: '#/components/examples/voiceConflictErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Conflict + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Call BXML + tags: + - Calls + x-content-type: application/xml + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences: + get: + description: |- + Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. + + **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel="next"`) will be returned in the response. The url can be used to retrieve the next page of conference records. + operationId: listConferences + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Filter results by the `name` field. + example: my-custom-name + explode: true + in: query + name: name + required: false + schema: + type: string + style: form + - description: Filter results to conferences which have a `createdTime` after + or at `minCreatedTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: minCreatedTime + required: false + schema: + type: string + style: form + - description: Filter results to conferences which have a `createdTime` before + or at `maxCreatedTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: maxCreatedTime + required: false + schema: + type: string + style: form + - description: Specifies the max number of conferences that will be returned. + example: 500 + explode: true + in: query + name: pageSize + required: false + schema: + default: 1000 + format: int32 + maximum: 1000 + minimum: 1 + type: integer + style: form + - description: "Not intended for explicit use. To use pagination, follow the\ + \ links in the `Link` header of the response, as indicated in the endpoint\ + \ description." + explode: true + in: query + name: pageToken + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + examples: + listConferences Response: + $ref: '#/components/examples/listConferencesResponseExample' + schema: + items: + $ref: '#/components/schemas/conference' + type: array + description: Conferences retrieved successfully + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Conferences + tags: + - Conferences + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}: + get: + description: Returns information about the specified conference. + operationId: getConference + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conference' + description: Conferences retrieved successfully + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Conference Information + tags: + - Conferences + x-accepts: application/json + post: + description: Update the conference state. + operationId: updateConference + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateConferenceRequest' + responses: + "204": + description: Conference was successfully modified. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Conference + tags: + - Conferences + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}/bxml: + put: + description: Update the conference BXML document. + operationId: updateConferenceBxml + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateConferenceBxmlRequest' + responses: + "204": + description: Conference successfully modified. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Conference BXML + tags: + - Conferences + x-content-type: application/xml + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}/members/{memberId}: + get: + description: Returns information about the specified conference member. + operationId: getConferenceMember + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference Member ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: memberId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceMember' + description: Conference member found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Conference Member + tags: + - Conferences + x-accepts: application/json + put: + description: Updates settings for a particular conference member. + operationId: updateConferenceMember + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference Member ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: memberId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateConferenceMemberRequest' + responses: + "204": + description: Conference member was successfully modified. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Conference Member + tags: + - Conferences + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}/recordings: + get: + description: Returns a (potentially empty) list of metadata for the recordings + that took place during the specified conference. + operationId: listConferenceRecordings + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/conferenceRecordingMetadata' + type: array + description: Conference recordings retrieved successfully + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Conference Recordings + tags: + - Conferences + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}: + get: + description: Returns metadata for the specified recording. + operationId: getConferenceRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceRecordingMetadata' + description: Conference recording found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Conference Recording Information + tags: + - Conferences + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media: + get: + description: Downloads the specified recording file. + operationId: downloadConferenceRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + audio/vnd.wave: + schema: + format: binary + type: string + audio/mpeg: + schema: + format: binary + type: string + description: Media found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Download Conference Recording + tags: + - Conferences + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/recordings: + get: + description: |- + Returns a list of metadata for the recordings associated with the + specified account. The list can be filtered by the optional from, to, minStartTime, + and maxStartTime arguments. The list is capped at 1000 entries and may be + empty if no recordings match the specified criteria. + operationId: listAccountCallRecordings + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Filter results by the `to` field. + example: '%2b19195551234' + explode: true + in: query + name: to + required: false + schema: + type: string + style: form + - description: Filter results by the `from` field. + example: '%2b19195554321' + explode: true + in: query + name: from + required: false + schema: + type: string + style: form + - description: Filter results to recordings which have a `startTime` after or + including `minStartTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: minStartTime + required: false + schema: + type: string + style: form + - description: Filter results to recordings which have a `startTime` before + `maxStartTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: maxStartTime + required: false + schema: + type: string + style: form + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/callRecordingMetadata' + type: array + description: Recordings retrieved successfully + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Call Recordings + tags: + - Recordings + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/recording: + put: + description: Pause or resume a recording on an active phone call. + operationId: updateCallRecordingState + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/updateCallRecordingRequest' + responses: + "200": + description: Recording state was successfully modified. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Update Recording + tags: + - Recordings + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/recordings: + get: + description: |- + Returns a (potentially empty) list of metadata for the recordings + that took place during the specified call. + operationId: listCallRecordings + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/callRecordingMetadata' + type: array + description: Recordings retrieved successfully + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: List Call Recordings + tags: + - Recordings + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}: + delete: + description: |- + Delete the recording information, media and transcription. + + Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + operationId: deleteRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "204": + description: Recording was deleted. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Delete Recording + tags: + - Recordings + x-accepts: application/json + get: + description: Returns metadata for the specified recording. + operationId: getCallRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/callRecordingMetadata' + description: Recording found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Call Recording + tags: + - Recordings + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media: + delete: + description: Deletes the specified recording's media. + operationId: deleteRecordingMedia + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "204": + description: The recording media was successfully deleted. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Delete Recording Media + tags: + - Recordings + x-accepts: application/json + get: + description: Downloads the specified recording. + operationId: downloadCallRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + audio/vnd.wave: + schema: + format: binary + type: string + audio/mpeg: + schema: + format: binary + type: string + description: Media found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Download Recording + tags: + - Recordings + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription: + delete: + description: |- + Deletes the specified recording's transcription. + + Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + operationId: deleteCallTranscription + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "204": + description: The transcription was successfully deleted. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Delete Transcription + tags: + - Recordings + x-accepts: application/json + get: + description: |- + Downloads the specified transcription. + + If the transcribed recording was multi-channel, then there will be 2 transcripts. + The caller/called party transcript will be the first item while [``](/docs/voice/bxml/playAudio) and [``](/docs/voice/bxml/speakSentence) transcript will be the second item. + During a [``](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + operationId: getCallTranscription + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/transcriptionList' + description: Transcription found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Transcription + tags: + - Recordings + x-accepts: application/json + post: + description: |- + Generate the transcription for a specific recording. Transcription + can succeed only for recordings of length greater than 500 milliseconds and + less than 4 hours. + operationId: transcribeCallRecording + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + - description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/transcribeRecordingRequest' + responses: + "204": + description: Transcription was successfully requested. + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Create Transcription Request + tags: + - Recordings + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/statistics: + get: + description: Returns details about the current state of the account. + operationId: getStatistics + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/accountStatistics' + description: Statistics Found + "400": + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + "404": + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + "405": + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + "415": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + "500": + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + summary: Get Account Statistics + tags: + - Statistics + x-accepts: application/json + servers: + - description: Production + url: https://voice.bandwidth.com/api/v2 + /accounts/{accountId}/code/voice: + post: + description: Send an MFA Code via a phone call. + operationId: generateVoiceCode + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/codeRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/voiceCodeResponse' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaUnauthorizedRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaForbiddenRequestError' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Internal Server Error + summary: Voice Authentication Code + tags: + - MFA + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://mfa.bandwidth.com/api/v1 + /accounts/{accountId}/code/messaging: + post: + description: Send an MFA code via text message (SMS). + operationId: generateMessagingCode + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/codeRequest' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/messagingCodeResponse' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaUnauthorizedRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaForbiddenRequestError' + description: Forbidden + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Internal Server Error + summary: Messaging Authentication Code + tags: + - MFA + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://mfa.bandwidth.com/api/v1 + /accounts/{accountId}/code/verify: + post: + description: Verify a previously sent MFA code. + operationId: verifyCode + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/codeVerify' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/verifyCodeResponse' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaUnauthorizedRequestError' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaForbiddenRequestError' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Internal Server Error + summary: Verify Authentication Code + tags: + - MFA + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://mfa.bandwidth.com/api/v1 + /accounts/{accountId}/tnlookup: + post: + description: Create a Phone Number Lookup Request. + operationId: createLookup + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + requestBody: + $ref: '#/components/requestBodies/createLookupRequest' + responses: + "202": + content: + application/json: + examples: + lookupResponseExample: + $ref: '#/components/examples/lookupInProgressExample' + schema: + $ref: '#/components/schemas/createLookupResponse' + description: Accepted + "400": + content: + application/json: + examples: + badRequest: + summary: Example Bad Request Error + value: + message: "Some tns do not match e164 format: 1234" + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorized: + summary: Example Unauthorized Error + value: + message: Unauthorized + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbidden: + summary: Example Forbidden Error + value: + message: Authorization header requires 'Credential' parameter. + Authorization header requires 'Signature' parameter. Authorization + header requires 'SignedHeaders' parameter. Authorization header + requires existence of either a 'X-Amz-Date' or a 'Date' header. + Authorization=Basic Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Forbidden + "415": + content: + application/json: + examples: + mediaType: + summary: Example Unsupported Media Type Error + value: + message: Content-Type must be application/json. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unsupported Media Type + "429": + content: + application/json: + examples: + mediaType: + summary: Example Too Many Requests Error + value: + message: Too many requests. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Too Many Requests + "500": + content: + application/json: + examples: + mediaType: + summary: Example Internal Server Error Error + value: + message: Request has not been passed further. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Internal Server Error + summary: Create Lookup + tags: + - Phone Number Lookup + x-content-type: application/json + x-accepts: application/json + servers: + - description: Production + url: https://numbers.bandwidth.com/api/v1 + /accounts/{accountId}/tnlookup/{requestId}: + get: + description: Get an existing Phone Number Lookup Request. + operationId: getLookupStatus + parameters: + - description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + - description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + explode: false + in: path + name: requestId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + examples: + lookupInProgressExample: + $ref: '#/components/examples/lookupInProgressExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + lookupSingleNumberCompleteExample: + $ref: '#/components/examples/lookupSingleNumberCompleteExample' + lookupMultipleNumbersCompleteExample: + $ref: '#/components/examples/lookupMultipleNumbersCompleteExample' + lookupMultipleNumbersPartialCompleteExample: + $ref: '#/components/examples/lookupMultipleNumbersPartialCompleteExample' + lookupSingleNumberCompleteNoInfoExample: + $ref: '#/components/examples/lookupSingleNumberCompleteNoInfoExample' + schema: + $ref: '#/components/schemas/lookupStatus' + description: OK + "400": + content: + application/json: + examples: + badRequest: + summary: Example Bad Request Error + value: + message: "Some tns do not match e164 format: 1234" + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Bad Request + "401": + content: + application/json: + examples: + unauthorized: + summary: Example Unauthorized Error + value: + message: Unauthorized + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unauthorized + "403": + content: + application/json: + examples: + forbidden: + summary: Example Forbidden Error + value: + message: Authorization header requires 'Credential' parameter. + Authorization header requires 'Signature' parameter. Authorization + header requires 'SignedHeaders' parameter. Authorization header + requires existence of either a 'X-Amz-Date' or a 'Date' header. + Authorization=Basic Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Forbidden + "404": + description: Not Found + "429": + content: + application/json: + examples: + mediaType: + summary: Example Too Many Requests Error + value: + message: Too many requests. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Too Many Requests + "500": + content: + application/json: + examples: + mediaType: + summary: Example Internal Server Error Error + value: + message: Request has not been passed further. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Internal Server Error + summary: Get Lookup Request Status + tags: + - Phone Number Lookup + x-accepts: application/json + servers: + - description: Production + url: https://numbers.bandwidth.com/api/v1 +components: + callbacks: + inboundCallback: + '{inboundCallbackUrl}': + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/inboundMessageCallback' + description: Inbound Message Callback Payload + required: true + responses: + "200": + description: OK + statusCallback: + '{statusCallbackUrl}': + post: + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/messageSendingCallback' + - $ref: '#/components/schemas/messageDeliveredCallback' + - $ref: '#/components/schemas/messageFailedCallback' + type: object + description: Status Callback Payload + required: true + responses: + "200": + description: OK + examples: + createCallResponseExample: + summary: Example of a createCall Response + value: + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + accountId: "9900000" + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + to: +19195551234 + from: +19195554312 + enqueuedTime: 2022-06-16T13:15:07.160Z + callUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callTimeout: 30 + callbackTimeout: 15 + tag: My custom tag value + answerMethod: POST + answerUrl: https://myServer.example/bandwidth/webhooks/answer + answerFallbackMethod: POST + disconnectMethod: POST + disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect + username: mySecretUsername + password: '*****' + fallbackUsername: mySecretUsername + fallbackPassword: '*****' + priority: 5 + listConferencesResponseExample: + summary: Example of a listConferences Response + value: + - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: my-conference-name + createdTime: 2022-06-17T22:19:40.375Z + completedTime: 2022-06-17T22:20:00.000Z + conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent + conferenceEventMethod: POST + tag: my custom tag + voiceBadRequestErrorExample: + summary: Example of a Bad Request (400) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceUnauthorizedErrorExample: + summary: Example of an Unauthorized (401) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceForbiddenErrorExample: + summary: Example of a Forbidden (403) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceNotFoundErrorExample: + summary: Example of a Not Found (404) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceNotAllowedErrorExample: + summary: Example of a Not Allowed (405) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceConflictErrorExample: + summary: Example of a Conflict (409) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceUnsupportedMediaTypeErrorExample: + summary: Example of an Unsupported Media Type (415) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceTooManyRequestsErrorExample: + summary: Example of a Too Many Requests (429) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + voiceInternalServerErrorExample: + summary: Example of an Internal Server (500) Error + value: + type: validation + description: "Invalid answerUrl: only http and https are allowed." + singleNumberRequestExample: + summary: Example Number Lookup Request for One Number + value: + tns: + - +19195551234 + multipleNumberRequestExample: + summary: Example Number Lookup Request for Multiple Numbers + value: + tns: + - +19195551234 + - +19195554321 + lookupInProgressExample: + summary: Example Lookup In Progress Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + lookupFailedExample: + summary: Example Lookup Failed Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + failedTelephoneNumbers: + - +191955512345 + lookupSingleNumberCompleteExample: + summary: Example Single Number Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: "310" + Mobile Network Code: "010" + lookupMultipleNumbersCompleteExample: + summary: Example Multiple Numbers Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: "310" + Mobile Network Code: "010" + - Response Code: 0 + Message: NOERROR + E.164 Format: +19195554321 + Formatted: (919) 555-4321 + Country: US + Line Type: Mobile + Line Provider: T-Mobile USA + Mobile Country Code: "310" + Mobile Network Code: "160" + lookupMultipleNumbersPartialCompleteExample: + summary: Example Multiple Numbers Lookup Partial Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: "310" + Mobile Network Code: "010" + failedTelephoneNumbers: + - +191955512345 + lookupSingleNumberCompleteNoInfoExample: + summary: Example Single Number Lookup Complete with No Information Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 3 + Message: NXDOMAIN + E.164 Format: +19195550000 + Formatted: (919) 555-0000 + Country: US + parameters: + accountId: + description: Your Bandwidth Account ID. + example: "9900000" + explode: false + in: path + name: accountId + required: true + schema: + type: string + style: simple + mediaId: + description: Media ID to retrieve. + example: 14762070468292kw2fuqty55yp2b2/0/bw.png + explode: false + in: path + name: mediaId + required: true + schema: + type: string + style: simple + contentType: + description: The media type of the entity-body. + example: audio/wav + explode: false + in: header + name: Content-Type + required: false + schema: + type: string + style: simple + cacheControl: + description: General-header field is used to specify directives that MUST be + obeyed by all caching mechanisms along the request/response chain. + example: no-cache + explode: false + in: header + name: Cache-Control + required: false + schema: + type: string + style: simple + continuationToken: + description: Continuation token used to retrieve subsequent media. + example: 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39 + explode: false + in: header + name: Continuation-Token + required: false + schema: + type: string + style: simple + messageId: + description: "The ID of the message to search for. Special characters need to\ + \ be encoded using URL encoding. Message IDs could come in different formats,\ + \ e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2\ + \ are valid message ID formats. Note that you must include at least one query\ + \ parameter." + example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + explode: true + in: query + name: messageId + required: false + schema: + type: string + style: form + sourceTn: + description: "The phone number that sent the message. Accepted values are: a\ + \ single full phone number a comma separated list of full phone numbers (maximum\ + \ of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919')." + example: '%2B15554443333' + explode: true + in: query + name: sourceTn + required: false + schema: + type: string + style: form + destinationTn: + description: "The phone number that received the message. Accepted values are:\ + \ a single full phone number a comma separated list of full phone numbers\ + \ (maximum of 10) or a single partial phone number (minimum of 5 characters\ + \ e.g. '%2B1919')." + example: '%2B15554443333' + explode: true + in: query + name: destinationTn + required: false + schema: + type: string + style: form + messageStatus: + description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. + explode: true + in: query + name: messageStatus + required: false + schema: + $ref: '#/components/schemas/messageStatusEnum' + style: form + messageDirection: + description: The direction of the message. One of INBOUND OUTBOUND. + explode: true + in: query + name: messageDirection + required: false + schema: + $ref: '#/components/schemas/listMessageDirectionEnum' + style: form + carrierName: + description: The name of the carrier used for this message. Possible values + include but are not limited to Verizon and TMobile. Special characters need + to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + example: Verizon + explode: true + in: query + name: carrierName + required: false + schema: + type: string + style: form + messageType: + description: The type of message. Either sms or mms. + explode: true + in: query + name: messageType + required: false + schema: + $ref: '#/components/schemas/messageTypeEnum' + style: form + errorCode: + description: The error code of the message. + example: 9902 + explode: true + in: query + name: errorCode + required: false + schema: + type: integer + style: form + fromDateTime: + description: The start of the date range to search in ISO 8601 format. Uses + the message receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + explode: true + in: query + name: fromDateTime + required: false + schema: + type: string + style: form + toDateTime: + description: The end of the date range to search in ISO 8601 format. Uses the + message receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + explode: true + in: query + name: toDateTime + required: false + schema: + type: string + style: form + campaignId: + description: The campaign ID of the message. + example: CJEUMDK + explode: true + in: query + name: campaignId + required: false + schema: + type: string + style: form + sort: + description: The field and direction to sort by combined with a colon. Direction + is either asc or desc. + example: sourceTn:desc + explode: true + in: query + name: sort + required: false + schema: + type: string + style: form + pageToken: + description: A base64 encoded value used for pagination of results. + example: gdEewhcJLQRB5 + explode: true + in: query + name: pageToken + required: false + schema: + type: string + style: form + limit: + description: The maximum records requested in search result. Default 100. The + sum of limit and after cannot be more than 10000. + example: 50 + explode: true + in: query + name: limit + required: false + schema: + type: integer + style: form + limitTotalCount: + description: "When set to true, the response's totalCount field will have a\ + \ maximum value of 10,000. When set to false, or excluded, this will give\ + \ an accurate totalCount of all messages that match the provided filters.\ + \ If you are experiencing latency, try using this parameter to limit your\ + \ results." + example: true + explode: true + in: query + name: limitTotalCount + required: false + schema: + type: boolean + style: form + callId: + description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: callId + required: true + schema: + type: string + style: simple + recordingId: + description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: recordingId + required: true + schema: + type: string + style: simple + conferenceId: + description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + explode: false + in: path + name: conferenceId + required: true + schema: + type: string + style: simple + memberId: + description: Programmable Voice API Conference Member ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + explode: false + in: path + name: memberId + required: true + schema: + type: string + style: simple + to: + description: Filter results by the `to` field. + example: '%2b19195551234' + explode: true + in: query + name: to + required: false + schema: + type: string + style: form + from: + description: Filter results by the `from` field. + example: '%2b19195554321' + explode: true + in: query + name: from + required: false + schema: + type: string + style: form + name: + description: Filter results by the `name` field. + example: my-custom-name + explode: true + in: query + name: name + required: false + schema: + type: string + style: form + minCreatedTime: + description: Filter results to conferences which have a `createdTime` after + or at `minCreatedTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: minCreatedTime + required: false + schema: + type: string + style: form + maxCreatedTime: + description: Filter results to conferences which have a `createdTime` before + or at `maxCreatedTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: maxCreatedTime + required: false + schema: + type: string + style: form + minStartTime: + description: Filter results to recordings which have a `startTime` after or + including `minStartTime` (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: minStartTime + required: false + schema: + type: string + style: form + maxStartTime: + description: Filter results to recordings which have a `startTime` before `maxStartTime` + (in ISO8601 format). + example: 2022-06-21T19:13:21Z + explode: true + in: query + name: maxStartTime + required: false + schema: + type: string + style: form + pageSize: + description: Specifies the max number of conferences that will be returned. + example: 500 + explode: true + in: query + name: pageSize + required: false + schema: + default: 1000 + format: int32 + maximum: 1000 + minimum: 1 + type: integer + style: form + pageToken1: + description: "Not intended for explicit use. To use pagination, follow the links\ + \ in the `Link` header of the response, as indicated in the endpoint description." + explode: true + in: query + name: pageToken + required: false + schema: + type: string + style: form + requestId: + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + explode: false + in: path + name: requestId + required: true + schema: + type: string + style: simple + requestBodies: + createMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/messageRequest' + required: true + uploadMediaRequest: + content: + application/json: + schema: + format: binary + type: string + application/ogg: + schema: + format: binary + type: string + application/pdf: + schema: + format: binary + type: string + application/rtf: + schema: + format: binary + type: string + application/zip: + schema: + format: binary + type: string + application/x-tar: + schema: + format: binary + type: string + application/xml: + schema: + format: binary + type: string + application/gzip: + schema: + format: binary + type: string + application/x-bzip2: + schema: + format: binary + type: string + application/x-gzip: + schema: + format: binary + type: string + application/smil: + schema: + format: binary + type: string + application/javascript: + schema: + format: binary + type: string + audio/mp4: + schema: + format: binary + type: string + audio/mpeg: + schema: + format: binary + type: string + audio/ogg: + schema: + format: binary + type: string + audio/flac: + schema: + format: binary + type: string + audio/webm: + schema: + format: binary + type: string + audio/wav: + schema: + format: binary + type: string + audio/amr: + schema: + format: binary + type: string + audio/3gpp: + schema: + format: binary + type: string + image/bmp: + schema: + format: binary + type: string + image/gif: + schema: + format: binary + type: string + image/jpeg: + schema: + format: binary + type: string + image/pjpeg: + schema: + format: binary + type: string + image/png: + schema: + format: binary + type: string + image/svg+xml: + schema: + format: binary + type: string + image/tiff: + schema: + format: binary + type: string + image/webp: + schema: + format: binary + type: string + image/x-icon: + schema: + format: binary + type: string + text/css: + schema: + format: binary + type: string + text/csv: + schema: + format: binary + type: string + text/calendar: + schema: + format: binary + type: string + text/plain: + schema: + format: binary + type: string + text/javascript: + schema: + format: binary + type: string + text/vcard: + schema: + format: binary + type: string + text/vnd.wap.wml: + schema: + format: binary + type: string + text/xml: + schema: + format: binary + type: string + video/avi: + schema: + format: binary + type: string + video/mp4: + schema: + format: binary + type: string + video/mpeg: + schema: + format: binary + type: string + video/ogg: + schema: + format: binary + type: string + video/quicktime: + schema: + format: binary + type: string + video/webm: + schema: + format: binary + type: string + video/x-ms-wmv: + schema: + format: binary + type: string + required: true + createCallRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/createCall' + description: JSON object containing information to create an outbound call + required: true + updateCallRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/updateCall' + description: JSON object containing information to redirect an existing call + to a new BXML document + required: true + updateCallBxmlRequest: + content: + application/xml: + examples: + speakSentence: + summary: Speak Sentence + value: |- + + + This is a test sentence. + + redirectUrl: + summary: Redirect + value: |- + + + + + schema: + description: A valid BXML document to replace the call's current BXML. + type: string + required: true + updateCallRecordingRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/updateCallRecording' + required: true + transcribeRecordingRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/transcribeRecording' + required: true + updateConferenceRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/updateConference' + required: true + updateConferenceBxmlRequest: + content: + application/xml: + examples: + stopRecording: + summary: Stop Recording + value: |- + + + + + schema: + description: A valid BXML document to replace the call's current BXML. + type: string + required: true + updateConferenceMemberRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/updateConferenceMember' + required: true + codeRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/codeRequest' + description: MFA code request body. + required: true + codeVerify: + content: + application/json: + schema: + $ref: '#/components/schemas/verifyCodeRequest' + description: MFA code verify request body. + required: true + createLookupRequest: + content: + application/json: + examples: + singleNumberRequestExample: + $ref: '#/components/examples/singleNumberRequestExample' + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' + schema: + $ref: '#/components/schemas/lookupRequest' + description: Phone number lookup request. + required: true + responses: + createMessageResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/message' + description: Accepted + listMessagesResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/messagesList' + description: OK + getMediaResponse: + content: + application/octet-stream: + schema: + description: Successful Operation + format: binary + type: string + description: OK + listMediaResponse: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/media' + type: array + description: OK + headers: + Continuation-Token: + description: Continuation token used to retrieve subsequent media. + explode: false + schema: + type: string + style: simple + messagingBadRequestError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Bad Request + messagingNotAcceptableError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Acceptable + createMessageBadRequestError: + content: + application/json: + schema: + $ref: '#/components/schemas/createMessageRequestError' + description: Bad Request + messagingUnauthorizedError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unauthorized + messagingForbiddenError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Forbidden + messagingNotFoundError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Not Found + messagingInvalidMediaTypeError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Unsupported Media Type + messagingTooManyRequestsError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Too Many Requests + messagingInternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + description: Internal Server Error + createCallResponse: + content: + application/json: + examples: + createCall Response: + $ref: '#/components/examples/createCallResponseExample' + schema: + $ref: '#/components/schemas/createCallResponse' + description: Call Successfully Created + headers: + Location: + description: The URL for further interactions with this call + explode: false + schema: + type: string + style: simple + getCallStateResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/callState' + description: Call found + getStatisticsResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/accountStatistics' + description: Statistics Found + listCallRecordingsResponse: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/callRecordingMetadata' + type: array + description: Recordings retrieved successfully + getCallRecordingResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/callRecordingMetadata' + description: Recording found + downloadRecordingMediaResponse: + content: + audio/vnd.wave: + schema: + format: binary + type: string + audio/mpeg: + schema: + format: binary + type: string + description: Media found + getCallTranscriptionResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/transcriptionList' + description: Transcription found + listConferencesResponse: + content: + application/json: + examples: + listConferences Response: + $ref: '#/components/examples/listConferencesResponseExample' + schema: + items: + $ref: '#/components/schemas/conference' + type: array + description: Conferences retrieved successfully + getConferenceResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/conference' + description: Conferences retrieved successfully + getConferenceMemberResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceMember' + description: Conference member found + listConferenceRecordingsResponse: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/conferenceRecordingMetadata' + type: array + description: Conference recordings retrieved successfully + getConferenceRecordingResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceRecordingMetadata' + description: Conference recording found + voiceBadRequestError: + content: + application/json: + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Bad Request + voiceUnauthorizedError: + content: + application/json: + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unauthorized + voiceForbiddenError: + content: + application/json: + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Forbidden + voiceNotFoundError: + content: + application/json: + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Not Found + voiceNotAllowedError: + content: + application/json: + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Method Not Allowed + voiceConflictError: + content: + application/json: + examples: + conflictErrorExample: + $ref: '#/components/examples/voiceConflictErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Conflict + voiceUnsupportedMediaTypeError: + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Unsupported Media Type + voiceTooManyRequestsError: + content: + application/json: + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + explode: false + schema: + type: string + style: simple + voiceInternalServerError: + content: + application/json: + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + schema: + $ref: '#/components/schemas/voiceApiError' + description: Internal Server Error + voiceCodeResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/voiceCodeResponse' + description: OK + messagingCodeResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/messagingCodeResponse' + description: OK + verifyCodeResponse: + content: + application/json: + schema: + $ref: '#/components/schemas/verifyCodeResponse' + description: OK + mfaBadRequestError: + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Bad Request + mfaUnauthorizedError: + content: + application/json: + schema: + $ref: '#/components/schemas/mfaUnauthorizedRequestError' + description: Unauthorized + mfaForbiddenError: + content: + application/json: + schema: + $ref: '#/components/schemas/mfaForbiddenRequestError' + description: Forbidden + mfaTooManyRequestsError: + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Too Many Requests + mfaInternalServerError: + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + description: Internal Server Error + createLookupResponse: + content: + application/json: + examples: + lookupResponseExample: + $ref: '#/components/examples/lookupInProgressExample' + schema: + $ref: '#/components/schemas/createLookupResponse' + description: Accepted + getLookupResponse: + content: + application/json: + examples: + lookupInProgressExample: + $ref: '#/components/examples/lookupInProgressExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + lookupSingleNumberCompleteExample: + $ref: '#/components/examples/lookupSingleNumberCompleteExample' + lookupMultipleNumbersCompleteExample: + $ref: '#/components/examples/lookupMultipleNumbersCompleteExample' + lookupMultipleNumbersPartialCompleteExample: + $ref: '#/components/examples/lookupMultipleNumbersPartialCompleteExample' + lookupSingleNumberCompleteNoInfoExample: + $ref: '#/components/examples/lookupSingleNumberCompleteNoInfoExample' + schema: + $ref: '#/components/schemas/lookupStatus' + description: OK + tnLookupBadRequestError: + content: + application/json: + examples: + badRequest: + summary: Example Bad Request Error + value: + message: "Some tns do not match e164 format: 1234" + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Bad Request + tnLookupUnauthorizedError: + content: + application/json: + examples: + unauthorized: + summary: Example Unauthorized Error + value: + message: Unauthorized + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unauthorized + tnLookupForbiddenError: + content: + application/json: + examples: + forbidden: + summary: Example Forbidden Error + value: + message: Authorization header requires 'Credential' parameter. Authorization + header requires 'Signature' parameter. Authorization header requires + 'SignedHeaders' parameter. Authorization header requires existence + of either a 'X-Amz-Date' or a 'Date' header. Authorization=Basic + Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Forbidden + tnLookupMediaTypeError: + content: + application/json: + examples: + mediaType: + summary: Example Unsupported Media Type Error + value: + message: Content-Type must be application/json. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Unsupported Media Type + tnLookupTooManyRequestsError: + content: + application/json: + examples: + mediaType: + summary: Example Too Many Requests Error + value: + message: Too many requests. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Too Many Requests + tnLookupInternalServerError: + content: + application/json: + examples: + mediaType: + summary: Example Internal Server Error Error + value: + message: Request has not been passed further. + schema: + $ref: '#/components/schemas/tnLookupRequestError' + description: Internal Server Error + schemas: + priorityEnum: + description: |- + The priority specified by the user. + + Not supported on MMS. + enum: + - default + - high + example: default + type: string + messageStatusEnum: + description: The status of the message. One of RECEIVED QUEUED SENDING SENT + FAILED DELIVERED ACCEPTED UNDELIVERED. + enum: + - RECEIVED + - QUEUED + - SENDING + - SENT + - FAILED + - DELIVERED + - ACCEPTED + - UNDELIVERED + example: RECEIVED + type: string + listMessageDirectionEnum: + description: The direction of the message. One of INBOUND OUTBOUND. + enum: + - INBOUND + - OUTBOUND + type: string + messageDirectionEnum: + description: The direction of the message. One of in out. + enum: + - in + - out + type: string + messageTypeEnum: + description: The type of message. Either SMS or MMS. + enum: + - sms + - mms + example: sms + type: string + fieldError: + properties: + fieldName: + description: The name of the field that contains the error + example: from + type: string + description: + description: The error associated with the field + example: '''+invalid'' must be replaced with a valid E164 formatted telephone + number' + type: string + type: object + messagesList: + example: + pageInfo: + prevPageToken: DLAPE902 + nextPage: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C + nextPageToken: GL83PD3C + prevPage: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 + messages: + - sourceTn: +15554443333 + messageLength: 18 + campaignId: CJEUMDK + messageId: 1589228074636lm4k2je7j7jklbn2 + errorCode: 9902 + destinationTn: +15554442222 + segmentCount: 1 + messageStatus: RECEIVED + receiveTime: 2020-04-07T14:03:07Z + accountId: "9900000" + messageDirection: null + messageType: sms + carrierName: other + recipientCount: 1 + campaignClass: T + attachmentCount: 1 + messageSize: 27 + - sourceTn: +15554443333 + messageLength: 18 + campaignId: CJEUMDK + messageId: 1589228074636lm4k2je7j7jklbn2 + errorCode: 9902 + destinationTn: +15554442222 + segmentCount: 1 + messageStatus: RECEIVED + receiveTime: 2020-04-07T14:03:07Z + accountId: "9900000" + messageDirection: null + messageType: sms + carrierName: other + recipientCount: 1 + campaignClass: T + attachmentCount: 1 + messageSize: 27 + totalCount: 100 + properties: + totalCount: + description: "The total number of messages matched by the search. When the\ + \ request has limitTotalCount set to true this value is limited to 10,000." + example: 100 + type: integer + pageInfo: + $ref: '#/components/schemas/pageInfo' + messages: + items: + $ref: '#/components/schemas/listMessageItem' + type: array + title: MessagesList + type: object + listMessageItem: + example: + sourceTn: +15554443333 + messageLength: 18 + campaignId: CJEUMDK + messageId: 1589228074636lm4k2je7j7jklbn2 + errorCode: 9902 + destinationTn: +15554442222 + segmentCount: 1 + messageStatus: RECEIVED + receiveTime: 2020-04-07T14:03:07Z + accountId: "9900000" + messageDirection: null + messageType: sms + carrierName: other + recipientCount: 1 + campaignClass: T + attachmentCount: 1 + messageSize: 27 + properties: + messageId: + description: The message id + example: 1589228074636lm4k2je7j7jklbn2 + type: string + accountId: + description: The account id associated with this message. + example: "9900000" + type: string + sourceTn: + description: The source phone number of the message. + example: +15554443333 + type: string + destinationTn: + description: The recipient phone number of the message. + example: +15554442222 + type: string + messageStatus: + $ref: '#/components/schemas/messageStatusEnum' + messageDirection: + $ref: '#/components/schemas/listMessageDirectionEnum' + messageType: + $ref: '#/components/schemas/messageTypeEnum' + segmentCount: + description: The number of segments the message was sent as. + example: 1 + type: integer + errorCode: + description: The numeric error code of the message. + example: 9902 + type: integer + receiveTime: + description: The ISO 8601 datetime of the message. + example: 2020-04-07T14:03:07Z + format: date-time + type: string + carrierName: + description: The name of the carrier. Not currently supported for MMS coming + soon. + example: other + nullable: true + type: string + messageSize: + description: The size of the message including message content and headers. + example: 27 + nullable: true + type: integer + messageLength: + description: The length of the message content. + example: 18 + type: integer + attachmentCount: + description: The number of attachments the message has. + example: 1 + nullable: true + type: integer + recipientCount: + description: The number of recipients the message has. + example: 1 + nullable: true + type: integer + campaignClass: + description: The campaign class of the message if it has one. + example: T + nullable: true + type: string + campaignId: + description: The campaign ID of the message if it has one. + example: CJEUMDK + nullable: true + type: string + title: listMessageItem + type: object + pageInfo: + example: + prevPageToken: DLAPE902 + nextPage: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C + nextPageToken: GL83PD3C + prevPage: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 + properties: + prevPage: + description: The link to the previous page for pagination. + example: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 + type: string + nextPage: + description: The link to the next page for pagination. + example: https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C + type: string + prevPageToken: + description: The isolated pagination token for the previous page. + example: DLAPE902 + type: string + nextPageToken: + description: The isolated pagination token for the next page. + example: GL83PD3C + type: string + title: PageInfo + type: object + messagingRequestError: + properties: + type: + type: string + description: + type: string + required: + - description + - type + title: MessagingRequestError + type: object + createMessageRequestError: + properties: + type: + type: string + description: + type: string + fieldErrors: + items: + $ref: '#/components/schemas/fieldError' + type: array + required: + - description + - type + title: CreateMessageRequestError + type: object + media: + example: + contentLength: 0 + content: content + mediaName: mediaName + properties: + content: + type: string + contentLength: + type: integer + mediaName: + type: string + title: Media + type: object + tag: + properties: + key: + type: string + value: + type: string + title: Tag + type: object + deferredResult: + properties: + result: + type: object + setOrExpired: + type: boolean + title: DeferredResult + type: object + message: + example: + owner: +15554443333 + media: + - https://dev.bandwidth.com/images/bandwidth-logo.png + priority: default + segmentCount: 2 + from: +15553332222 + expiration: 2021-02-01T11:29:18-05:00 + id: 1589228074636lm4k2je7j7jklbn2 + time: 2022-09-14T18:20:16Z + to: + - +15552223333 + text: Hello world + tag: custom tag + applicationId: 93de2206-9669-4e07-948d-329f4b722ee2 + direction: null + properties: + id: + description: The id of the message. + example: 1589228074636lm4k2je7j7jklbn2 + type: string + owner: + description: The Bandwidth phone number associated with the message. + example: +15554443333 + type: string + applicationId: + description: The application ID associated with the message. + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + time: + description: The datetime stamp of the message in ISO 8601 + example: 2022-09-14T18:20:16Z + format: date-time + type: string + segmentCount: + description: The number of segments the original message from the user is + broken into before sending over to carrier networks. + example: 2 + type: integer + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + description: The phone number recipients of the message. + example: + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + description: The phone number the message was sent from. + example: +15553332222 + type: string + media: + description: The list of media URLs sent in the message. Including a `filename` + field in the `Content-Disposition` header of the media linked with a URL + will set the displayed file name. This is a best practice to ensure that + your media has a readable file name. + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + items: + type: string + type: array + uniqueItems: true + text: + description: The contents of the message. + example: Hello world + type: string + tag: + description: The custom string set by the user. + example: custom tag + type: string + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + description: The expiration date-time set by the user. + example: 2021-02-01T11:29:18-05:00 + format: date-time + type: string + title: Message + type: object + messageRequest: + properties: + applicationId: + description: The ID of the Application your from number is associated with + in the Bandwidth Phone Number Dashboard. + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + to: + description: The phone number(s) the message should be sent to in E164 format. + example: + - +15554443333 + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + description: One of your telephone numbers the message should come from + in E164 format. + example: +15551113333 + type: string + text: + description: The contents of the text message. Must be 2048 characters or + less. + example: Hello world + maxLength: 2048 + type: string + media: + description: |- + A list of URLs to include as media attachments as part of the message. + Each URL can be at most 4096 characters. + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + items: + format: uri + maxLength: 4096 + type: string + type: array + tag: + description: A custom string that will be included in callback events of + the message. Max 1024 characters. + example: custom string + type: string + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + description: |- + A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. + Not supported on MMS. + example: 2021-02-01T11:29:18-05:00 + format: date-time + type: string + required: + - applicationId + - from + - to + title: MessageRequest + type: object + inboundMessageCallback: + description: Inbound Message Callback + properties: + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + type: + example: message-received + type: string + to: + example: +15552223333 + type: string + description: + example: Incoming message received + type: string + message: + $ref: '#/components/schemas/inboundMessageCallbackMessage' + required: + - description + - message + - time + - to + - type + type: object + inboundMessageCallbackMessage: + description: Inbound Message Callback Message Schema + properties: + id: + example: 1661365814859loidf7mcwd4qacn7 + type: string + owner: + example: +15553332222 + type: string + applicationId: + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + segmentCount: + example: 1 + type: integer + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + example: + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + example: +15553332222 + type: string + text: + example: Hello world + type: string + tag: + example: custom string + type: string + media: + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + items: + format: uri + type: string + type: array + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - applicationId + - direction + - from + - id + - owner + - segmentCount + - text + - time + - to + type: object + messageSendingCallback: + description: Message Sending Callback + properties: + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + type: + example: message-sending + type: string + to: + example: +15552223333 + type: string + description: + example: Message is sending to carrier + type: string + message: + $ref: '#/components/schemas/messageSendingCallbackMessage' + required: + - description + - message + - time + - to + - type + type: object + messageSendingCallbackMessage: + description: Message Sending Callback Message Schema + properties: + id: + example: 1661365814859loidf7mcwd4qacn7 + type: string + owner: + example: +15553332222 + type: string + applicationId: + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + segmentCount: + example: 1 + type: integer + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + example: + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + example: +15553332222 + type: string + text: + example: Hello world + type: string + tag: + example: custom string + type: string + media: + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + items: + format: uri + type: string + type: array + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - applicationId + - direction + - from + - id + - media + - owner + - priority + - segmentCount + - text + - time + - to + type: object + messageDeliveredCallback: + description: Message Delivered Callback + properties: + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + type: + example: message-delivered + type: string + to: + example: +15552223333 + type: string + description: + example: Message delivered to carrier. + type: string + message: + $ref: '#/components/schemas/messageDeliveredCallbackMessage' + required: + - description + - message + - time + - to + - type + type: object + messageDeliveredCallbackMessage: + description: Message Delivered Callback Message Schema + properties: + id: + example: 1661365814859loidf7mcwd4qacn7 + type: string + owner: + example: +15553332222 + type: string + applicationId: + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + segmentCount: + example: 1 + type: integer + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + example: + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + example: +15553332222 + type: string + text: + example: Hello world + type: string + tag: + example: custom string + type: string + media: + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + items: + format: uri + type: string + type: array + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - applicationId + - direction + - from + - id + - owner + - segmentCount + - tag + - text + - time + - to + type: object + messageFailedCallback: + description: Message Failed Callback + properties: + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + type: + example: message-failed + type: string + to: + example: +15552223333 + type: string + description: + example: rejected-unallocated-from-number + type: string + message: + $ref: '#/components/schemas/messageFailedCallbackMessage' + errorCode: + example: 9902 + type: integer + required: + - description + - errorCode + - message + - time + - to + - type + type: object + messageFailedCallbackMessage: + description: Message Failed Callback Message Schema + properties: + id: + example: 1661365814859loidf7mcwd4qacn7 + type: string + owner: + example: +15553332222 + type: string + applicationId: + example: 93de2206-9669-4e07-948d-329f4b722ee2 + type: string + time: + example: 2016-09-14T18:20:16Z + format: date-time + type: string + segmentCount: + example: 1 + type: integer + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + example: + - +15552223333 + items: + type: string + type: array + uniqueItems: true + from: + example: +15553332222 + type: string + text: + example: Hello world + type: string + tag: + example: custom string + type: string + media: + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + items: + format: uri + type: string + type: array + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - applicationId + - direction + - from + - id + - owner + - priority + - segmentCount + - tag + - text + - time + - to + type: object + callbackMethodEnum: + default: POST + description: The HTTP method to use to deliver the callback. GET or POST. Default + value is POST. + enum: + - GET + - POST + example: POST + nullable: true + type: string + redirectMethodEnum: + default: POST + description: |- + The HTTP method to use for the request to `redirectUrl`. GET + or POST. Default value is POST.

Not allowed if `state` is `completed`. + enum: + - GET + - POST + example: POST + nullable: true + type: string + recordingStateEnum: + description: |- + The recording state. Possible values: + + `paused` to pause an active recording + + `recording` to resume a paused recording + enum: + - paused + - recording + example: paused + type: string + callDirectionEnum: + description: The direction of the call. + enum: + - inbound + - outbound + example: inbound + type: string + fileFormatEnum: + description: The format that the recording is stored in. + enum: + - mp3 + - wav + example: wav + type: string + callStateEnum: + default: active + description: |- + The call state. Possible values:
`active` to redirect the + call (default)
`completed` to hang up the call if it is answered, cancel + it if it is an unanswered outbound call, or reject it if it an unanswered + inbound call + enum: + - active + - completed + example: completed + nullable: true + type: string + conferenceStateEnum: + default: active + description: Setting the conference state to `completed` ends the conference + and ejects all members. + enum: + - active + - completed + example: completed + nullable: true + type: string + machineDetectionModeEnum: + default: async + description: |- + The machine detection mode. If set to 'async', the detection + result will be sent in a 'machineDetectionComplete' callback. If set to + 'sync', the 'answer' callback will wait for the machine detection to complete + and will include its result. + enum: + - sync + - async + example: async + type: string + createCall: + properties: + to: + description: |- + The destination to call (must be an E.164 formatted number + (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). + example: +19195551234 + type: string + from: + description: |- + A Bandwidth phone number on your account the call should come + from (must be in E.164 format, like `+15555551212`, or be one of the following + strings: `Restricted`, `Anonymous`, `Private`, or `Unavailable`). + example: +19195554321 + type: string + displayName: + description: "The caller display name to use when the call is created. \n\ + May not exceed 256 characters nor contain control characters such as new\ + \ lines." + example: John Doe + maxLength: 256 + nullable: true + type: string + uui: + description: |- + A comma-separated list of 'User-To-User' headers to be sent + in the INVITE when calling a SIP URI. Each value must end with an 'encoding' + parameter as described in RFC + 7433. Only 'jwt' and 'base64' encodings are allowed. The entire value + cannot exceed 350 characters, including parameters and separators. + example: "eyJhbGciOiJIUzI1NiJ9.WyJoaSJd.-znkjYyCkgz4djmHUPSXl9YrJ6Nix_XvmlwKGFh5ERM;encoding=jwt,aGVsbG8gd29ybGQ;encoding=base64" + nullable: true + type: string + applicationId: + description: The id of the application associated with the `from` number. + example: 1234-qwer-5679-tyui + type: string + answerUrl: + description: |- + The full URL to send the Answer + event to when the called party answers. This endpoint should return the + first BXML document to be executed in the + call. + + Must use `https` if specifying `username` and `password`. + example: https://www.myCallbackServer.example/webhooks/answer + format: uri + maxLength: 2048 + type: string + answerMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + answerFallbackUrl: + description: |- + A fallback url which, if provided, will be used to retry the + `answer` webhook delivery in case `answerUrl` fails to respond + + Must use `https` if specifying `fallbackUsername` and `fallbackPassword`. + example: https://www.myFallbackServer.example/webhooks/answer + format: uri + maxLength: 2048 + nullable: true + type: string + answerFallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + fallbackUsername: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + fallbackPassword: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + disconnectUrl: + description: The URL to send the Disconnect + event to when the call ends. This event does not expect a BXML response. + example: https://www.myCallbackServer.example/webhooks/disconnect + format: uri + maxLength: 2048 + nullable: true + type: string + disconnectMethod: + $ref: '#/components/schemas/callbackMethodEnum' + callTimeout: + default: 30 + description: |- + The timeout (in seconds) for the callee to answer the call + after it starts ringing. If the call does not start ringing within 30s, + the call will be cancelled regardless of this value. Can be any numeric + value (including decimals) between 1 and 300. + example: 30 + format: double + maximum: 300 + minimum: 1 + nullable: true + type: number + callbackTimeout: + default: 15 + description: |- + This is the timeout (in seconds) to use when delivering webhooks + for the call. Can be any numeric value (including decimals) between 1 + and 25. + example: 15 + format: double + maximum: 25 + minimum: 1 + nullable: true + type: number + machineDetection: + $ref: '#/components/schemas/machineDetectionConfiguration' + priority: + default: 5 + description: |- + The priority of this call over other calls from your account. For example, if during a call + your application needs to place a new call and bridge it with the current + call, you might want to create the call with priority 1 so that it will + be the next call picked off your queue, ahead of other less time sensitive + calls. A lower value means higher priority, so a priority 1 call takes + precedence over a priority 2 call. + example: 5 + maximum: 5 + minimum: 1 + nullable: true + type: integer + tag: + description: |- + A custom string that will be sent with all webhooks for this + call unless overwritten by a future `` + verb or `tag` attribute on another verb, or cleared. + + May be cleared by setting `tag=""` + + Max length 256 characters. + example: arbitrary text here + maxLength: 256 + nullable: true + type: string + required: + - answerUrl + - applicationId + - from + - to + type: object + createCallResponse: + example: + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + answerUrl: https://myServer.example/bandwidth/webhooks/answer + callUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callbackTimeout: 15 + answerFallbackMethod: POST + answerFallbackUrl: https://myFallbackServer.example/bandwidth/webhooks/answer + callTimeout: 30 + priority: 5 + disconnectMethod: POST + accountId: "9900000" + password: mySecretPassword1! + answerMethod: POST + enqueuedTime: 2022-06-16T13:15:07.16Z + disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect + from: +19195554321 + fallbackPassword: mySecretPassword1! + to: +19195551234 + tag: My custom tag value + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + username: mySecretUsername + fallbackUsername: mySecretUsername + properties: + applicationId: + description: The id of the application associated with the `from` number. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + accountId: + description: The bandwidth account ID associated with the call. + example: "9900000" + type: string + callId: + description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + to: + description: Recipient of the outgoing call. + example: +19195551234 + type: string + from: + description: Phone number that created the outbound call. + example: +19195554321 + type: string + enqueuedTime: + description: The time at which the call was accepted into the queue. + example: 2022-06-16T13:15:07.16Z + format: date-time + nullable: true + type: string + callUrl: + description: The URL to update this call's state. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + format: uri + type: string + callTimeout: + description: The timeout (in seconds) for the callee to answer the call + after it starts ringing. + example: 30 + format: double + type: number + callbackTimeout: + description: This is the timeout (in seconds) to use when delivering webhooks + for the call. + example: 15 + format: double + type: number + tag: + description: Custom tag value. + example: My custom tag value + nullable: true + type: string + answerMethod: + $ref: '#/components/schemas/callbackMethodEnum' + answerUrl: + description: URL to deliver the `answer` event webhook. + example: https://myServer.example/bandwidth/webhooks/answer + format: uri + type: string + answerFallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + answerFallbackUrl: + description: Fallback URL to deliver the `answer` event webhook. + example: https://myFallbackServer.example/bandwidth/webhooks/answer + format: uri + nullable: true + type: string + disconnectMethod: + $ref: '#/components/schemas/callbackMethodEnum' + disconnectUrl: + description: URL to deliver the `disconnect` event webhook. + example: https://myServer.example/bandwidth/webhooks/disconnect + format: uri + nullable: true + type: string + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + fallbackUsername: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + fallbackPassword: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + priority: + description: The priority of this call over other calls from your account. + example: 5 + nullable: true + type: integer + required: + - accountId + - answerMethod + - answerUrl + - applicationId + - callId + - callUrl + - disconnectMethod + - from + - to + type: object + callState: + example: + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + answerTime: 2022-06-16T13:15:18.126Z + parentCallId: c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + disconnectCause: disconnectCause + errorMessage: errorMessage + accountId: "9900000" + identity: eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9idy1zaGFrZW4tY2VydC1wdWIuczMuYW1hem9uYXdzLmNvbS9iYW5kd2lkdGgtc2hha2VuLWNlcnRfMjAyMzA3MTYucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTg0MjgyMDI4MCJdfSwiaWF0IjoxNjU2NTM0MzM2LCJvcmlnIjp7InRuIjoiMTkxOTQ0NDI2ODMifSwib3JpZ2lkIjoiNDk0NTlhOGEtNDJmNi0zNTFjLTkzNjEtYWRmNTdhOWUwOGNhIn0.56un9sRw_uH-sbJvnUsqdevlVxbOVjn8MVlGTlBMicjaZuRRwxfiNp-C9zYCMKTTCbc-QdYPN05F61XNVN4D3w;info=;alg=ES256;ppt=shaken + enqueuedTime: 2022-06-16T13:15:07.16Z + lastUpdate: 2022-06-16T13:15:18.314Z + stirShaken: + verstat: TN-Verification-Passed + attestationIndicator: A + originatingId: abc123 + from: "19195554321" + startTime: 2022-06-16T13:15:07.16Z + to: +19195551234 + state: disconnected + endTime: 2022-06-16T13:15:18.314Z + errorId: errorId + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + direction: inbound + properties: + applicationId: + description: The application id associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + accountId: + description: The account id associated with the call. + example: "9900000" + type: string + callId: + description: The programmable voice API call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "The A-leg call id, set only if this call is the B-leg of a\ + \ [``](/docs/voice/bxml/transfer)." + example: c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + nullable: true + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555), or if the call was to a SIP URI, the SIP URI." + example: +19195551234 + type: string + from: + description: "The phone number that made the call, in E.164 format (e.g.\ + \ +15555555555)." + example: "19195554321" + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + state: + description: |- + The current state of the call. Current possible values are + `queued`, `initiated`, `answered` and `disconnected`. Additional states + may be added in the future, so your application must be tolerant of unknown + values. + example: disconnected + type: string + stirShaken: + additionalProperties: + type: string + description: |- + For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. + The verification status is stored in the call state `stirShaken` property as follows. + + | Property | Description | + |:------------------|:------------| + | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Verification-Passed` or `TN-Verification-Failed`. | + | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | + | originatingId | (optional) A unique origination identifier. | + + Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. + + More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). + example: + verstat: TN-Verification-Passed + attestationIndicator: A + originatingId: abc123 + nullable: true + type: object + identity: + description: |- + The value of the `Identity` header from the inbound invite + request. Only present for inbound calls and if the account is configured + to forward this header. + example: eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9idy1zaGFrZW4tY2VydC1wdWIuczMuYW1hem9uYXdzLmNvbS9iYW5kd2lkdGgtc2hha2VuLWNlcnRfMjAyMzA3MTYucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTg0MjgyMDI4MCJdfSwiaWF0IjoxNjU2NTM0MzM2LCJvcmlnIjp7InRuIjoiMTkxOTQ0NDI2ODMifSwib3JpZ2lkIjoiNDk0NTlhOGEtNDJmNi0zNTFjLTkzNjEtYWRmNTdhOWUwOGNhIn0.56un9sRw_uH-sbJvnUsqdevlVxbOVjn8MVlGTlBMicjaZuRRwxfiNp-C9zYCMKTTCbc-QdYPN05F61XNVN4D3w;info=;alg=ES256;ppt=shaken + nullable: true + type: string + enqueuedTime: + description: The time this call was placed in queue. + example: 2022-06-16T13:15:07.16Z + format: date-time + nullable: true + type: string + startTime: + description: "The time the call was initiated, in ISO 8601 format. `null`\ + \ if the call is still in your queue." + example: 2022-06-16T13:15:07.16Z + format: date-time + nullable: true + type: string + answerTime: + description: "Populated once the call has been answered, with the time in\ + \ ISO 8601 format." + example: 2022-06-16T13:15:18.126Z + format: date-time + nullable: true + type: string + endTime: + description: "Populated once the call has ended, with the time in ISO 8601\ + \ format." + example: 2022-06-16T13:15:18.314Z + format: date-time + nullable: true + type: string + disconnectCause: + description: |- + | Cause | Description | + |:------|:------------| + | `hangup`| One party hung up the call, a [``](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | + | `busy` | Callee was busy. | + | `timeout` | Call wasn't answered before the `callTimeout` was reached. | + | `cancel` | Call was cancelled by its originator while it was ringing. | + | `rejected` | Call was rejected by the callee. | + | `callback-error` | BXML callback couldn't be delivered to your callback server. | + | `invalid-bxml` | Invalid BXML was returned in response to a callback. | + | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | + | `account-limit` | Account rate limits were reached. | + | `node-capacity-exceeded` | System maximum capacity was reached. | + | `error` | Some error not described in any of the other causes happened on the call. | + | `unknown` | Unknown error happened on the call. | + + Note: This list is not exhaustive and other values can appear in the future. + nullable: true + type: string + errorMessage: + description: "Populated only if the call ended with an error, with text\ + \ explaining the reason." + nullable: true + type: string + example: null + errorId: + description: "Populated only if the call ended with an error, with a Bandwidth\ + \ internal id that references the error event." + nullable: true + type: string + example: null + lastUpdate: + description: "The last time the call had a state update, in ISO 8601 format." + example: 2022-06-16T13:15:18.314Z + format: date-time + type: string + type: object + updateCall: + properties: + state: + $ref: '#/components/schemas/callStateEnum' + redirectUrl: + description: |- + The URL to send the [Redirect](/docs/voice/bxml/redirect) event + to which will provide new BXML. + + Required if `state` is `active`. + + Not allowed if `state` is `completed`. + example: https://myServer.example/bandwidth/webhooks/redirect + format: uri + nullable: true + type: string + redirectMethod: + $ref: '#/components/schemas/redirectMethodEnum' + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + redirectFallbackUrl: + description: |- + A fallback url which, if provided, will be used to retry the + redirect callback delivery in case `redirectUrl` fails to respond. + example: https://myFallbackServer.example/bandwidth/webhooks/redirect + format: uri + nullable: true + type: string + redirectFallbackMethod: + $ref: '#/components/schemas/redirectMethodEnum' + fallbackUsername: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + fallbackPassword: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + tag: + description: |- + A custom string that will be sent with this and all future + callbacks unless overwritten by a future `tag` attribute or [``](/docs/voice/bxml/tag) + verb, or cleared. + + May be cleared by setting `tag=""`. + + Max length 256 characters. + + Not allowed if `state` is `completed`. + example: My Custom Tag + maxLength: 256 + nullable: true + type: string + type: object + updateCallRecording: + properties: + state: + $ref: '#/components/schemas/recordingStateEnum' + required: + - state + type: object + accountStatistics: + example: + currentCallQueueSize: 0 + maxCallQueueSize: 900 + properties: + currentCallQueueSize: + description: The number of calls currently enqueued. + example: 0 + type: integer + maxCallQueueSize: + description: The maximum size of the queue before outgoing calls start being + rejected. + example: 900 + type: integer + type: object + callRecordingMetadata: + example: + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + mediaUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + transcription: + completedTime: 2022-06-13T18:46:29.715Z + id: t-387bd648-18f3-4823-9d16-746bca0003c9 + url: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcription + status: completed + parentCallId: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + transferCallerId: +15555555555 + transferTo: +15555555555) + duration: PT13.67S + accountId: "920012" + channels: 1 + from: +15555555555 + startTime: 2022-06-17T22:19:40.375Z + to: +15555555555 + endTime: 2022-06-17T22:20:00Z + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + recordingId: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + fileFormat: wav + direction: inbound + status: completed + properties: + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + channels: + description: Always `1` for conference recordings; multi-channel recordings + are not supported on conferences. + example: 1 + format: int32 + type: integer + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + status: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + transcription: + $ref: '#/components/schemas/transcriptionMetadata' + type: object + conference: + example: + conferenceEventMethod: POST + activeMembers: + - callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callIdsToCoach: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + conferenceId: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + memberUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/members/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + mute: false + hold: false + - callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callIdsToCoach: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + conferenceId: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + memberUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/members/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + mute: false + hold: false + conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent + completedTime: 2022-06-17T22:20:00Z + name: my-conference-name + createdTime: 2022-06-17T22:19:40.375Z + id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + tag: my custom tag + properties: + id: + description: The Bandwidth-generated conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: "The name of the conference, as specified by your application." + example: my-conference-name + type: string + createdTime: + description: "The time the conference was initiated, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + completedTime: + description: "The time the conference was terminated, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + conferenceEventUrl: + description: The URL to send the conference-related events. + example: https://myServer.example/bandwidth/webhooks/conferenceEvent + format: uri + nullable: true + type: string + conferenceEventMethod: + $ref: '#/components/schemas/callbackMethodEnum' + tag: + description: The custom string attached to the conference that will be sent + with callbacks. + example: my custom tag + nullable: true + type: string + activeMembers: + description: |- + A list of active members of the conference. Omitted if this + is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). + items: + $ref: '#/components/schemas/conferenceMember' + nullable: true + type: array + type: object + updateConference: + properties: + status: + $ref: '#/components/schemas/conferenceStateEnum' + redirectUrl: + description: |- + The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) + event which will provide new BXML. Not allowed if `state` is `completed`, + but required if `state` is `active`. + example: https://myServer.example/bandwidth/webhooks/conferenceRedirect + format: uri + nullable: true + type: string + redirectMethod: + $ref: '#/components/schemas/redirectMethodEnum' + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + redirectFallbackUrl: + description: |- + A fallback url which, if provided, will be used to retry the + `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not + allowed if `state` is `completed`. + example: https://myFallbackServer.example/bandwidth/webhooks/conferenceRedirect + format: uri + nullable: true + type: string + redirectFallbackMethod: + $ref: '#/components/schemas/redirectMethodEnum' + fallbackUsername: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + fallbackPassword: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + type: object + conferenceMember: + example: + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callIdsToCoach: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + conferenceId: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + memberUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/members/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + mute: false + hold: false + properties: + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + memberUrl: + description: |- + A URL that may be used to retrieve information about or update + the state of this conference member. This is the URL of this member's + [Get Conference Member](/apis/voice/#operation/getConferenceMember) endpoint + and [Modify Conference Member](/apis/voice/#operation/updateConferenceMember) + endpoint. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/members/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + mute: + description: |- + Whether or not this member is currently muted. Members who are muted are still able to hear other participants. + + If used in a PUT request, updates this member's mute status. Has no effect if omitted. + example: false + type: boolean + hold: + description: |- + Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. + + If used in a PUT request, updates this member's hold status. Has no effect if omitted. + example: false + type: boolean + callIdsToCoach: + description: |- + If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. + + If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. + Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. + example: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + items: + type: string + nullable: true + type: array + type: object + updateConferenceMember: + properties: + mute: + description: |- + Whether or not this member is currently muted. Members who are muted are still able to hear other participants. + + Updates this member's mute status. Has no effect if omitted. + example: false + type: boolean + hold: + description: |- + Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. + + Updates this member's hold status. Has no effect if omitted. + example: false + type: boolean + callIdsToCoach: + description: |- + If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. + + Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. + + Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. + example: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + items: + type: string + nullable: true + type: array + type: object + conferenceRecordingMetadata: + example: + duration: PT13.67S + accountId: "920012" + channels: 1 + mediaUrl: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + conferenceId: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: my-conference-name + startTime: 2022-06-17T22:19:40.375Z + endTime: 2022-06-17T22:20:00Z + recordingId: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + fileFormat: wav + status: completed + properties: + accountId: + description: The user account associated with the call. + example: "920012" + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + channels: + description: Always `1` for conference recordings; multi-channel recordings + are not supported on conferences. + example: 1 + format: int32 + type: integer + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + status: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + type: object + machineDetectionConfiguration: + description: The machine detection request used to perform machine + detection on the call. + properties: + mode: + $ref: '#/components/schemas/machineDetectionModeEnum' + detectionTimeout: + default: 15 + description: |- + The timeout used for the whole operation, in seconds. If no + result is determined in this period, a callback with a `timeout` result + is sent. + example: 15 + format: double + nullable: true + type: number + silenceTimeout: + default: 10 + description: "If no speech is detected in this period, a callback with a\ + \ 'silence' result is sent." + example: 10 + format: double + nullable: true + type: number + speechThreshold: + default: 10 + description: |- + When speech has ended and a result couldn't be determined based + on the audio content itself, this value is used to determine if the speaker + is a machine based on the speech duration. If the length of the speech + detected is greater than or equal to this threshold, the result will be + 'answering-machine'. If the length of speech detected is below this threshold, + the result will be 'human'. + example: 10 + format: double + nullable: true + type: number + speechEndThreshold: + default: 5 + description: Amount of silence (in seconds) before assuming the callee has + finished speaking. + example: 5 + format: double + nullable: true + type: number + machineSpeechEndThreshold: + description: "When an answering machine is detected, the amount of silence\ + \ (in seconds) before assuming the message has finished playing. \nIf\ + \ not provided it will default to the speechEndThreshold value." + example: 5 + format: double + nullable: true + type: number + delayResult: + default: false + description: |- + If set to 'true' and if an answering machine is detected, the + 'answering-machine' callback will be delayed until the machine is done + speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' + result is sent immediately. + example: false + nullable: true + type: boolean + callbackUrl: + description: The URL to send the 'machineDetectionComplete' webhook when + the detection is completed. Only for 'async' mode. + example: https://myServer.example/bandwidth/webhooks/machineDetectionComplete + format: uri + maxLength: 2048 + nullable: true + type: string + callbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + fallbackUrl: + description: |- + A fallback URL which, if provided, will be used to retry the + machine detection complete webhook delivery in case `callbackUrl` fails + to respond + example: https://myFallbackServer.example/bandwidth/webhooks/machineDetectionComplete + format: uri + maxLength: 2048 + nullable: true + type: string + fallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + fallbackUsername: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + fallbackPassword: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + type: object + transcribeRecording: + properties: + callbackUrl: + description: |- + The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) + event to. You should not include sensitive or personally-identifiable + information in the callbackUrl field! Always use the proper username and + password fields for authorization. + example: https://myServer.example/bandwidth/webhooks/transcriptionAvailable + format: uri + type: string + callbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + description: Basic auth username. + example: mySecretUsername + maxLength: 1024 + nullable: true + type: string + password: + description: Basic auth password. + example: mySecretPassword1! + maxLength: 1024 + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + callbackTimeout: + default: 15 + description: |- + This is the timeout (in seconds) to use when delivering the + webhook to `callbackUrl`. Can be any numeric value (including decimals) + between 1 and 25. + example: 5.5 + format: double + maximum: 25 + minimum: 1 + nullable: true + type: number + detectLanguage: + default: false + description: "A boolean value to indicate that the recording may not be\ + \ in English, and the transcription service will need to detect the dominant\ + \ language the recording is in and transcribe accordingly. Current supported\ + \ languages are English, French, and Spanish." + example: true + nullable: true + type: boolean + type: object + transcriptionList: + example: + transcripts: + - confidence: 0.9 + text: "Nice talking to you, friend!" + - confidence: 0.9 + text: "Nice talking to you, friend!" + properties: + transcripts: + items: + $ref: '#/components/schemas/transcription' + type: array + type: object + transcriptionMetadata: + description: "If the recording was transcribed, metadata about the transcription" + example: + completedTime: 2022-06-13T18:46:29.715Z + id: t-387bd648-18f3-4823-9d16-746bca0003c9 + url: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcription + status: completed + nullable: true + properties: + id: + description: The unique transcription ID + example: t-387bd648-18f3-4823-9d16-746bca0003c9 + type: string + status: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + completedTime: + description: The time that the transcription was completed + example: 2022-06-13T18:46:29.715Z + type: string + url: + description: "The URL of the [transcription](#operation/getCallTranscription)" + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcription + format: uri + type: string + type: object + voiceApiError: + properties: + type: + type: string + description: + type: string + id: + nullable: true + type: string + type: object + answerCallback: + description: The Answer event is sent to the answerUrl specified in the createCall + request when an outbound call is answered. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + machineDetectionResult: + $ref: '#/components/schemas/machineDetectionResult' + type: object + bridgeCompleteCallback: + description: "If the target call leaves the , then this callback is\ + \ sent to the bridgeCompleteUrl, and the BXML returned in it is executed on\ + \ the call. If this webhook is sent, the Bridge Target Complete webhook is\ + \ NOT sent. This callback is also sent if any problem occurs that prevents\ + \ the calls to be bridged." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + cause: + description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ + \ callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded,\ + \ error, or unknown." + example: busy + type: string + errorMessage: + description: Text explaining the reason that caused the call to fail in + case of errors. + example: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already + bridged with another call + nullable: true + type: string + errorId: + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + type: string + type: object + bridgeTargetCompleteCallback: + description: "If the originating call leaves the , then this callback\ + \ is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed\ + \ on the target call. If this webhook is sent, the Bridge Complete webhook\ + \ is NOT sent." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceCreatedCallback: + description: "The Conference Created event is fired whenever a new conference\ + \ that specified a callbackUrl is created. The response may be either empty\ + \ or a BXML document. Only the following verbs are valid for conferences:\ + \ PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording,\ + \ ResumeRecording. Audio verbs will be heard by all members of the conference.\ + \ Recordings capture audio from all members who are not muted or on hold,\ + \ as well as any audio verbs that are played into the conference." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceRedirectCallback: + description: "The Conference Redirect event is fired whenever an existing conference\ + \ is modified via a POST request made to the /conferences/{conferenceId} endpoint.\ + \ The response may be either empty or a BXML document. Only the following\ + \ verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording,\ + \ StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard\ + \ by all members of the conference. Recordings capture audio from all members\ + \ who are not muted or on hold, as well as any audio verbs that are played\ + \ into the conference." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceMemberJoinCallback: + description: "The Conference Member Join event is fired whenever a caller joins\ + \ a conference that specified a callbackUrl. The response may be either empty\ + \ or a BXML document. Only the following verbs are valid for conferences:\ + \ PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording,\ + \ ResumeRecording. Audio verbs will be heard by all members of the conference.\ + \ Recordings capture audio from all members who are not muted or on hold,\ + \ as well as any audio verbs that are played into the conference." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceMemberExitCallback: + description: "The Conference Member Exit event is fired whenever a caller exits\ + \ a conference that specified a callbackUrl. The response may be either empty\ + \ or a BXML document. Only the following verbs are valid for conferences:\ + \ PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording,\ + \ ResumeRecording. Audio verbs will be heard by all members of the conference.\ + \ Recordings capture audio from all members who are not muted or on hold,\ + \ as well as any audio verbs that are played into the conference." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceCompletedCallback: + description: The Conference Completed event is fired when the last member leaves + the conference. The response to this event may not contain BXML. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + conferenceRecordingAvailableCallback: + description: The Conference Recording Available event is sent after a conference + recording has been processed. It indicates that the recording is available + for download. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that\ + \ was recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + channels: + description: Always `1` for conference recordings; multi-channel recordings + are not supported on conferences. + example: 1 + format: int32 + type: integer + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + status: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + type: object + disconnectCallback: + description: "The Disconnect event is fired when a call ends, for any reason." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + cause: + description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ + \ callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded,\ + \ error, or unknown." + example: busy + type: string + errorMessage: + description: Text explaining the reason that caused the call to fail in + case of errors. + example: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already + bridged with another call + nullable: true + type: string + errorId: + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + dtmfCallback: + description: The DTMF event is sent for every digit detected after a + verb is executed. You may not respond to this event with BXML. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + digit: + description: The digit collected in the call. + example: "2" + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + gatherCallback: + description: The gather event is sent after a verb is executed. Its + purpose is to report the gathered digits to the calling application. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + digits: + description: "(optional) The digits, letters, and/or symbols entered by\ + \ the user. The string is empty if a timeout occurred before any buttons\ + \ were pressed." + example: "123" + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + terminatingDigit: + description: (optional) The digit the user pressed to end the gather. Empty + string value if no terminating digit was pressed. + example: '#' + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + type: object + initiateCallback: + description: The Initiate event is fired when an inbound call is received for + a Telephone Number on your Account. It is sent to the URL specified in the + application associated with the location (sip-peer) that the called telephone + number belongs to. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + diversion: + $ref: '#/components/schemas/diversion' + stirShaken: + $ref: '#/components/schemas/stirShaken' + type: object + machineDetectionCompleteCallback: + description: "This event is sent to the url informed when requesting a machine\ + \ detection operation. It contains the machine detection operation result,\ + \ which can be: human, answering-machine, silence, timeout, error. This event\ + \ is not sent when sync answering machine detection mode is chosen." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + machineDetectionResult: + $ref: '#/components/schemas/machineDetectionResult' + type: object + recordingCompleteCallback: + description: "The Record Complete event is sent after a verb has executed\ + \ if the call is still active. The BXML returned by this callback is executed\ + \ next. When the recording is available for download, a Recording Available\ + \ event will be sent." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + channels: + description: Always `1` for conference recordings; multi-channel recordings + are not supported on conferences. + example: 1 + format: int32 + type: integer + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + type: object + recordingAvailableCallback: + description: The Recording Available event is sent after a recording has been + processed. It indicates that the recording is available for download. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + channels: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + status: + description: "The current status of the process. For recording, current\ + \ possible values are 'processing', 'partial', 'complete', 'deleted',\ + \ and 'error'. For transcriptions, current possible values are 'none',\ + \ 'processing', 'available', 'error', 'timeout', 'file-size-too-big',\ + \ and 'file-size-too-small'. Additional states may be added in the future,\ + \ so your application must be tolerant of unknown values." + example: completed + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + type: object + redirectCallback: + description: The Redirect event is fired when a verb is executed. + Its purpose is to get the next set of verbs from the calling application. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + type: object + transcriptionAvailableCallback: + description: The Transcription Available event is sent when the recording transcription + is available to be downloaded. + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transcription: + $ref: '#/components/schemas/transcription' + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + type: object + transferAnswerCallback: + description: "When processing a verb, this event is sent when a called\ + \ party (B-leg) answers. The event is sent to the endpoint specified in the\ + \ transferAnswerUrl attribute of the tag that answered. BXML\ + \ returned by this callback will be executed for the called party only. After\ + \ all BXML has been executed, the called party will be bridged to the original\ + \ call. Most BXML verbs are allowed in response to a transferAnswer event,\ + \ but some are not allowed." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + type: object + transferCompleteCallback: + description: "This event is sent to the transferCompleteUrl of the A-leg's \ + \ verb when the transferred call (B-leg) completes. In a simultaneous ringing\ + \ scenario, only one B-leg succeeds and this event corresponds to that successful\ + \ leg. If none of the calls were answered, the transferComplete event corresponds\ + \ to one of the legs." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + cause: + description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ + \ callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded,\ + \ error, or unknown." + example: busy + type: string + errorMessage: + description: Text explaining the reason that caused the call to fail in + case of errors. + example: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already + bridged with another call + nullable: true + type: string + errorId: + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + type: string + type: object + transferDisconnectCallback: + description: "This event is sent to the transferDisconnectUrl of each \ + \ tag when its respective call leg ends for any reason. The event is sent\ + \ in the normal case, when the transferred leg is answered and later hung\ + \ up, but is also sent if the new leg was never answered in the first place,\ + \ if it was rejected, and if the original call leg hung up before the transferred\ + \ leg." + properties: + eventType: + description: "The event type, value can be one of the following: answer,\ + \ bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect,\ + \ conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer,\ + \ transferComplete, transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly\ + \ the time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + from: + description: "The provided identifier of the caller: can be a phone number\ + \ in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + tag: + description: "(optional) The tag specified on call creation. If no tag was\ + \ specified or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call,\ + \ in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous,\ + \ Private, or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555)." + example: +15555555555) + type: string + cause: + description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ + \ callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded,\ + \ error, or unknown." + example: busy + type: string + errorMessage: + description: Text explaining the reason that caused the call to fail in + case of errors. + example: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already + bridged with another call + nullable: true + type: string + errorId: + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + type: string + type: object + eventType: + description: "The event type, value can be one of the following: answer, bridgeComplete,\ + \ bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin,\ + \ conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable,\ + \ disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete,\ + \ recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete,\ + \ transferDisconnect." + example: bridgeComplete + type: string + eventTime: + description: "The approximate UTC date and time when the event was generated\ + \ by the Bandwidth server, in ISO 8601 format. This may not be exactly the\ + \ time of event execution." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + accountId: + description: The user account associated with the call. + example: "920012" + type: string + applicationId: + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + type: string + to: + description: "The phone number that received the call, in E.164 format (e.g.\ + \ +15555555555)." + example: +15555555555 + type: string + from: + description: "The provided identifier of the caller: can be a phone number in\ + \ E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable,\ + \ or Anonymous." + example: +15555555555 + type: string + conferenceId: + description: "The unique, Bandwidth-generated ID of the conference that was\ + \ recorded" + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + type: string + name: + description: The user-specified name of the conference that was recorded + example: my-conference-name + type: string + recordingId: + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + type: string + duration: + description: The duration of the recording in ISO-8601 format + example: PT13.67S + type: string + channels: + description: Always `1` for conference recordings; multi-channel recordings + are not supported on conferences. + example: 1 + format: int32 + type: integer + digit: + description: The digit collected in the call. + example: "2" + type: string + digits: + description: "(optional) The digits, letters, and/or symbols entered by the\ + \ user. The string is empty if a timeout occurred before any buttons were\ + \ pressed." + example: "123" + type: string + terminatingDigit: + description: (optional) The digit the user pressed to end the gather. Empty + string value if no terminating digit was pressed. + example: '#' + type: string + startTime: + description: "Time the call was started, in ISO 8601 format." + example: 2022-06-17T22:19:40.375Z + format: date-time + type: string + enqueuedTime: + description: "(optional) If call queueing is enabled and this is an outbound\ + \ call, time the call was queued, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + answerTime: + description: "Time the call was answered, in ISO 8601 format." + example: 2022-06-17T22:20:00Z + format: date-time + nullable: true + type: string + endTime: + description: The time that the recording ended in ISO-8601 format + example: 2022-06-17T22:20:00Z + format: date-time + type: string + status: + description: "The current status of the process. For recording, current possible\ + \ values are 'processing', 'partial', 'complete', 'deleted', and 'error'.\ + \ For transcriptions, current possible values are 'none', 'processing', 'available',\ + \ 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional\ + \ states may be added in the future, so your application must be tolerant\ + \ of unknown values." + example: completed + type: string + transferCallerId: + description: "The phone number used as the from field of the B-leg call, in\ + \ E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private,\ + \ or Unavailable." + example: +15555555555 + type: string + transferTo: + description: "The phone number used as the to field of the B-leg call, in E.164\ + \ format (e.g. +15555555555)." + example: +15555555555) + type: string + mediaUrl: + description: The URL that can be used to download the recording. Only present + if the recording is finished and may be downloaded. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + format: uri + nullable: true + type: string + callId: + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + callUrl: + description: The URL of the call associated with the event. + example: https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + parentCallId: + description: "(optional) If the event is related to the B leg of a ,\ + \ the call id of the original call leg that executed the . Otherwise,\ + \ this field will not be present." + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + type: string + tag1: + description: "(optional) The tag specified on call creation. If no tag was specified\ + \ or it was previously cleared, this field will not be present." + example: exampleTag + nullable: true + type: string + cause: + description: "Reason the call failed - hangup, busy, timeout, cancel, rejected,\ + \ callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded,\ + \ error, or unknown." + example: busy + type: string + errorMessage: + description: Text explaining the reason that caused the call to fail in case + of errors. + example: Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already bridged + with another call + nullable: true + type: string + errorId: + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + type: string + machineDetectionResult: + description: "(optional) if machine detection was requested in sync mode, the\ + \ result will be specified here. Possible values are the same as the async\ + \ counterpart: Machine Detection Complete" + nullable: true + properties: + value: + description: "Possible values are answering-machine, human, silence, timeout,\ + \ or error." + example: answering-machine + type: string + duration: + description: The amount of time it took to determine the result. + example: PT4.9891287S + type: string + type: object + diversion: + properties: + reason: + description: "The reason for the diversion. Common values: unknown, user-busy,\ + \ no-answer, unavailable, unconditional, time-of-day, do-not-disturb,\ + \ deflection, follow-me, out-of-service, away." + example: unavailable + type: string + privacy: + description: off or full + example: "off" + type: string + screen: + description: "No if the number was provided by the user, yes if the number\ + \ was provided by the network" + example: "no" + type: string + counter: + description: The number of diversions that have occurred + example: "2" + type: string + limit: + description: The maximum number of diversions allowed for this session + example: "3" + type: string + unknown: + description: The normal list of values is not exhaustive. Your application + must be tolerant of unlisted keys and unlisted values of those keys. + example: unknownValue + type: string + origTo: + description: Always present. Indicates the last telephone number that the + call was diverted from. + example: +15558884444 + type: string + type: object + transcription: + example: + confidence: 0.9 + text: "Nice talking to you, friend!" + properties: + text: + description: The transcribed text + example: "Nice talking to you, friend!" + type: string + confidence: + description: "The confidence on the recognized content, ranging from `0.0`\ + \ to `1.0` with `1.0` being the highest confidence." + example: 0.9 + format: double + type: number + type: object + stirShaken: + properties: + verstat: + description: (optional) The verification status indicating whether the verification + was successful or not. Possible values are TN-Verification-Passed and + TN-Verification-Failed. + example: Tn-Verification-Passed + type: string + attestationIndicator: + description: "(optional) The attestation level verified by Bandwidth. Possible\ + \ values are A (full), B (partial) or C (gateway)." + example: A + type: string + originatingId: + description: (optional) A unique origination identifier. + example: 99759086-1335-11ed-9bcf-5f7d464e91af + type: string + type: object + codeRequest: + properties: + to: + description: The phone number to send the mfa code to. + example: +19195551234 + pattern: "^\\+[1-9]\\d{1,14}$" + type: string + from: + description: "The application phone number, the sender of the mfa code." + example: +19195554321 + maxLength: 32 + pattern: "^\\+[1-9]\\d{1,14}$" + type: string + applicationId: + description: "The application unique ID, obtained from Bandwidth." + example: 66fd98ae-ac8d-a00f-7fcd-ba3280aeb9b1 + maxLength: 50 + type: string + scope: + description: "An optional field to denote what scope or action the mfa code\ + \ is addressing. If not supplied, defaults to \"2FA\"." + example: 2FA + maxLength: 25 + type: string + message: + description: "The message format of the mfa code. There are three values\ + \ that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The\ + \ \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\"\ + \ must be supplied. As the name would suggest, code will be replace with\ + \ the actual mfa code. Name is replaced with the application name, configured\ + \ during provisioning of mfa. The scope value is the same value sent\ + \ during the call and partitioned by the server." + example: "Your temporary {NAME} {SCOPE} code is {CODE}" + maxLength: 2048 + type: string + digits: + description: "The number of digits for your mfa code. The valid number\ + \ ranges from 2 to 8, inclusively." + example: 6 + maximum: 8 + minimum: 4 + type: integer + required: + - applicationId + - digits + - from + - message + - to + type: object + voiceCodeResponse: + example: + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + properties: + callId: + description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + type: string + type: object + messagingCodeResponse: + example: + messageId: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + properties: + messageId: + description: Messaging API Message ID. + example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + type: string + type: object + verifyCodeRequest: + properties: + to: + description: The phone number to send the mfa code to. + example: +19195551234 + pattern: "^\\+[1-9]\\d{1,14}$" + type: string + scope: + description: "An optional field to denote what scope or action the mfa code\ + \ is addressing. If not supplied, defaults to \"2FA\"." + example: 2FA + type: string + expirationTimeInMinutes: + description: "The time period, in minutes, to validate the mfa code. By\ + \ setting this to 3 minutes, it will mean any code generated within the\ + \ last 3 minutes are still valid. The valid range for expiration time\ + \ is between 0 and 15 minutes, exclusively and inclusively, respectively." + example: 3 + maximum: 15 + minimum: 1 + type: number + code: + description: The generated mfa code to check if valid. + example: "123456" + maxLength: 8 + minLength: 4 + type: string + required: + - code + - expirationTimeInMinutes + - to + type: object + verifyCodeResponse: + example: + valid: true + properties: + valid: + description: Whether or not the supplied code is valid. + example: true + type: boolean + type: object + mfaRequestError: + properties: + error: + description: A message describing the error with your request. + example: 400 Request is malformed or invalid + type: string + requestId: + description: The associated requestId from AWS. + example: 354cc8a3-6701-461e-8fa7-8671703dd898 + type: string + type: object + mfaUnauthorizedRequestError: + properties: + message: + description: Unauthorized + example: Unauthorized + type: string + type: object + mfaForbiddenRequestError: + properties: + message: + description: The message containing the reason behind the request being + forbidden. + example: Missing Authentication Token + type: string + type: object + lookupStatusEnum: + description: "The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE,\ + \ or FAILED)." + enum: + - IN_PROGRESS + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + type: string + lookupRequest: + description: Create phone number lookup request. + properties: + tns: + items: + type: string + type: array + required: + - tns + type: object + createLookupResponse: + description: "The request has been accepted for processing but not yet finished\ + \ and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED)." + example: + requestId: requestId + status: COMPLETE + properties: + requestId: + description: The phone number lookup request ID from Bandwidth. + type: string + status: + $ref: '#/components/schemas/lookupStatusEnum' + type: object + lookupStatus: + description: "If requestId exists, the result for that request is returned.\ + \ See the Examples for details on the various responses that you can receive.\ + \ Generally, if you see a Response Code of 0 in a result for a TN, information\ + \ will be available for it. Any other Response Code will indicate no information\ + \ was available for the TN." + example: + result: + - E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Line Provider: Verizon Wireless + Message: NOERROR + Line Type: Mobile + Country: US + Mobile Country Code: "310" + Mobile Network Code: "010" + Response Code: 0 + - E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Line Provider: Verizon Wireless + Message: NOERROR + Line Type: Mobile + Country: US + Mobile Country Code: "310" + Mobile Network Code: "010" + Response Code: 0 + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + failedTelephoneNumbers: + - +191955512345 + status: COMPLETE + properties: + requestId: + description: The requestId. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + type: string + status: + $ref: '#/components/schemas/lookupStatusEnum' + result: + description: The carrier information results for the specified telephone + number. + items: + $ref: '#/components/schemas/lookupResult' + type: array + failedTelephoneNumbers: + description: The telephone numbers whose lookup failed. + example: + - +191955512345 + items: + type: string + type: array + type: object + lookupResult: + description: Carrier information results for the specified telephone number. + example: + E.164 Format: +19195551234 + Formatted: (919) 555-1234 + Line Provider: Verizon Wireless + Message: NOERROR + Line Type: Mobile + Country: US + Mobile Country Code: "310" + Mobile Network Code: "010" + Response Code: 0 + properties: + Response Code: + description: Our vendor's response code. + example: 0 + type: integer + Message: + description: Message associated with the response code. + example: NOERROR + type: string + E.164 Format: + description: The telephone number in E.164 format. + example: +19195551234 + type: string + Formatted: + description: The formatted version of the telephone number. + example: (919) 555-1234 + type: string + Country: + description: The country of the telephone number. + example: US + type: string + Line Type: + description: The line type of the telephone number. + example: Mobile + type: string + Line Provider: + description: The messaging service provider of the telephone number. + example: Verizon Wireless + type: string + Mobile Country Code: + description: The first half of the Home Network Identity (HNI). + example: "310" + type: string + Mobile Network Code: + description: The second half of the HNI. + example: "010" + type: string + type: object + tnLookupRequestError: + properties: + message: + description: A description of what validation error occurred. + example: example error message + type: string + type: object + securitySchemes: + Basic: + description: |- + Basic authentication is a simple authentication scheme built into the + HTTP protocol. To use it, send your HTTP requests with an Authorization + header that contains the word Basic followed by a space and a + base64-encoded string `username:password`Example: `Authorization: Basic + ZGVtbZpwQDU1dzByZA==` + scheme: basic + type: http + diff --git a/bandwidth.yml b/bandwidth.yml new file mode 100644 index 00000000..1cbcd06f --- /dev/null +++ b/bandwidth.yml @@ -0,0 +1,5626 @@ +openapi: 3.0.3 +info: + title: Bandwidth + description: Bandwidth's Communication APIs + contact: + name: Bandwidth + url: https://dev.bandwidth.com + email: letstalk@bandwidth.com + version: 1.0.0 +security: + - Basic: [] +tags: + - name: Messages + - name: Media + - name: Calls + - name: Conferences + - name: Recordings + - name: Statistics + - name: MFA + - name: Phone Number Lookup +paths: + /users/{accountId}/media: + get: + summary: List Media + description: Gets a list of your media files. No query parameters are supported. + operationId: listMedia + tags: + - Media + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/continuationToken' + responses: + '200': + $ref: '#/components/responses/listMediaResponse' + '400': + $ref: '#/components/responses/messagingBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + servers: &ref_0 + - url: https://messaging.bandwidth.com/api/v2 + description: Production + /users/{accountId}/media/{mediaId}: + get: + summary: Get Media + description: Downloads a media file you previously uploaded. + operationId: getMedia + tags: + - Media + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/mediaId' + responses: + '200': + $ref: '#/components/responses/getMediaResponse' + '400': + $ref: '#/components/responses/messagingBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + put: + summary: Upload Media + description: >- + Upload a file. You may add headers to the request in order to provide + some control to your media file. + + + If a file is uploaded with the same name as a file that already exists + under this account, the previous file will be overwritten. + + + A list of supported media types can be found + [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + operationId: uploadMedia + tags: + - Media + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/mediaId' + - $ref: '#/components/parameters/contentType' + - $ref: '#/components/parameters/cacheControl' + requestBody: + $ref: '#/components/requestBodies/uploadMediaRequest' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/messagingBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + delete: + summary: Delete Media + description: |- + Deletes a media file from Bandwidth API server. Make sure you don't have + any application scripts still using the media before you delete. + + If you accidentally delete a media file you can immediately upload a new + file with the same name. + operationId: deleteMedia + tags: + - Media + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/mediaId' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/messagingBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + servers: *ref_0 + /users/{accountId}/messages: + get: + summary: List Messages + description: Returns a list of messages based on query parameters. + operationId: listMessages + tags: + - Messages + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/messageId' + - $ref: '#/components/parameters/sourceTn' + - $ref: '#/components/parameters/destinationTn' + - $ref: '#/components/parameters/messageStatus' + - $ref: '#/components/parameters/messageDirection' + - $ref: '#/components/parameters/carrierName' + - $ref: '#/components/parameters/messageType' + - $ref: '#/components/parameters/errorCode' + - $ref: '#/components/parameters/fromDateTime' + - $ref: '#/components/parameters/toDateTime' + - $ref: '#/components/parameters/campaignId' + - $ref: '#/components/parameters/sort' + - $ref: '#/components/parameters/pageToken' + - $ref: '#/components/parameters/limit' + - $ref: '#/components/parameters/limitTotalCount' + responses: + '200': + $ref: '#/components/responses/listMessagesResponse' + '400': + $ref: '#/components/responses/messagingBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + post: + summary: Create Message + description: >- + Endpoint for sending text messages and picture messages using V2 + messaging. + operationId: createMessage + tags: + - Messages + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/createMessageRequest' + responses: + '202': + $ref: '#/components/responses/createMessageResponse' + '400': + $ref: '#/components/responses/createMessageBadRequestError' + '401': + $ref: '#/components/responses/messagingUnauthorizedError' + '403': + $ref: '#/components/responses/messagingForbiddenError' + '404': + $ref: '#/components/responses/messagingNotFoundError' + '406': + $ref: '#/components/responses/messagingNotAcceptableError' + '415': + $ref: '#/components/responses/messagingInvalidMediaTypeError' + '429': + $ref: '#/components/responses/messagingTooManyRequestsError' + '500': + $ref: '#/components/responses/messagingInternalServerError' + callbacks: + inboundCallback: + $ref: '#/components/callbacks/inboundCallback' + statusCallback: + $ref: '#/components/callbacks/statusCallback' + servers: *ref_0 + /accounts/{accountId}/calls: + post: + tags: + - Calls + summary: Create Call + description: >- + Creates an outbound phone call. + + + All calls are initially queued. Your outbound calls will initiated at a + specific dequeueing rate, enabling your application to "fire and forget" + when creating calls. Queued calls may not be modified until they are + dequeued and placed, but may be removed from your queue on demand. + + + Please note: Calls submitted to your queue will be placed + approximately in order, but exact ordering is not guaranteed. + operationId: createCall + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/createCallRequest' + responses: + '201': + $ref: '#/components/responses/createCallResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: &ref_1 + - url: https://voice.bandwidth.com/api/v2 + description: Production + /accounts/{accountId}/calls/{callId}: + get: + tags: + - Calls + summary: Get Call State Information + description: >- + Retrieve the current state of a specific call. This information is + near-realtime, so it may take a few minutes for your call to be + accessible using this endpoint. + + + **Note**: Call information is kept for 7 days after the calls are hung + up. If you attempt to retrieve information for a call that is older than + 7 days, you will get an HTTP 404 response. + operationId: getCallState + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + responses: + '200': + $ref: '#/components/responses/getCallStateResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + post: + tags: + - Calls + summary: Update Call + description: >- + Interrupts and redirects a call to a different URL that should return a + BXML document. + operationId: updateCall + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + requestBody: + $ref: '#/components/requestBodies/updateCallRequest' + responses: + '200': + description: Call was successfully modified. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '409': + $ref: '#/components/responses/voiceConflictError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/bxml: + put: + tags: + - Calls + summary: Update Call BXML + description: Interrupts and replaces an active call's BXML document. + operationId: updateCallBxml + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + requestBody: + $ref: '#/components/requestBodies/updateCallBxmlRequest' + responses: + '204': + description: Call BXML was successfully replaced. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '409': + $ref: '#/components/responses/voiceConflictError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences: + get: + tags: + - Conferences + summary: Get Conferences + description: >- + Returns a max of 1000 conferences, sorted by `createdTime` from oldest + to newest. + + + **NOTE:** If the number of conferences in the account is bigger than + `pageSize`, a `Link` header (with format `<{url}>; rel="next"`) will be + returned in the response. The url can be used to retrieve the next page + of conference records. + operationId: listConferences + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/name' + - $ref: '#/components/parameters/minCreatedTime' + - $ref: '#/components/parameters/maxCreatedTime' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/pageToken1' + responses: + '200': + $ref: '#/components/responses/listConferencesResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}: + get: + tags: + - Conferences + summary: Get Conference Information + description: Returns information about the specified conference. + operationId: getConference + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + responses: + '200': + $ref: '#/components/responses/getConferenceResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + post: + tags: + - Conferences + summary: Update Conference + description: Update the conference state. + operationId: updateConference + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + requestBody: + $ref: '#/components/requestBodies/updateConferenceRequest' + responses: + '204': + description: Conference was successfully modified. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}/bxml: + put: + tags: + - Conferences + summary: Update Conference BXML + description: Update the conference BXML document. + operationId: updateConferenceBxml + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + requestBody: + $ref: '#/components/requestBodies/updateConferenceBxmlRequest' + responses: + '204': + description: Conference successfully modified. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}/members/{memberId}: + get: + tags: + - Conferences + summary: Get Conference Member + description: Returns information about the specified conference member. + operationId: getConferenceMember + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + - $ref: '#/components/parameters/memberId' + responses: + '200': + $ref: '#/components/responses/getConferenceMemberResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + put: + tags: + - Conferences + summary: Update Conference Member + description: Updates settings for a particular conference member. + operationId: updateConferenceMember + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + - $ref: '#/components/parameters/memberId' + requestBody: + $ref: '#/components/requestBodies/updateConferenceMemberRequest' + responses: + '204': + description: Conference member was successfully modified. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}/recordings: + get: + tags: + - Conferences + summary: Get Conference Recordings + description: >- + Returns a (potentially empty) list of metadata for the recordings that + took place during the specified conference. + operationId: listConferenceRecordings + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + responses: + '200': + $ref: '#/components/responses/listConferenceRecordingsResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}: + get: + tags: + - Conferences + summary: Get Conference Recording Information + description: Returns metadata for the specified recording. + operationId: getConferenceRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/getConferenceRecordingResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media: + get: + tags: + - Conferences + summary: Download Conference Recording + description: Downloads the specified recording file. + operationId: downloadConferenceRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/conferenceId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/downloadRecordingMediaResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/recordings: + get: + tags: + - Recordings + summary: Get Call Recordings + description: >- + Returns a list of metadata for the recordings associated with the + + specified account. The list can be filtered by the optional from, to, + minStartTime, + + and maxStartTime arguments. The list is capped at 1000 entries and may + be + + empty if no recordings match the specified criteria. + operationId: listAccountCallRecordings + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/to' + - $ref: '#/components/parameters/from' + - $ref: '#/components/parameters/minStartTime' + - $ref: '#/components/parameters/maxStartTime' + responses: + '200': + $ref: '#/components/responses/listCallRecordingsResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/recording: + put: + tags: + - Recordings + summary: Update Recording + description: Pause or resume a recording on an active phone call. + operationId: updateCallRecordingState + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + requestBody: + $ref: '#/components/requestBodies/updateCallRecordingRequest' + responses: + '200': + description: Recording state was successfully modified. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/recordings: + get: + tags: + - Recordings + summary: List Call Recordings + description: |- + Returns a (potentially empty) list of metadata for the recordings + that took place during the specified call. + operationId: listCallRecordings + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + responses: + '200': + $ref: '#/components/responses/listCallRecordingsResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}: + get: + tags: + - Recordings + summary: Get Call Recording + description: Returns metadata for the specified recording. + operationId: getCallRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/getCallRecordingResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + delete: + tags: + - Recordings + summary: Delete Recording + description: >- + Delete the recording information, media and transcription. + + + Note: After the deletion is requested and a `204` is returned, neither + the recording metadata nor the actual media nor its transcription will + be accessible anymore. However, the media of the specified recording is + not deleted immediately. This deletion process, while transparent and + irreversible, can take an additional 24 to 48 hours. + operationId: deleteRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '204': + description: Recording was deleted. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media: + get: + tags: + - Recordings + summary: Download Recording + description: Downloads the specified recording. + operationId: downloadCallRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/downloadRecordingMediaResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + delete: + tags: + - Recordings + summary: Delete Recording Media + description: Deletes the specified recording's media. + operationId: deleteRecordingMedia + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '204': + description: The recording media was successfully deleted. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription: + get: + tags: + - Recordings + summary: Get Transcription + description: >- + Downloads the specified transcription. + + + If the transcribed recording was multi-channel, then there will be 2 + transcripts. + + The caller/called party transcript will be the first item while + [``](/docs/voice/bxml/playAudio) and + [``](/docs/voice/bxml/speakSentence) transcript will be + the second item. + + During a [``](/docs/voice/bxml/transfer) the A-leg transcript + will be the first item while the B-leg transcript will be the second + item. + operationId: getCallTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '200': + $ref: '#/components/responses/getCallTranscriptionResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + post: + tags: + - Recordings + summary: Create Transcription Request + description: >- + Generate the transcription for a specific recording. Transcription + + can succeed only for recordings of length greater than 500 milliseconds + and + + less than 4 hours. + operationId: transcribeCallRecording + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + requestBody: + $ref: '#/components/requestBodies/transcribeRecordingRequest' + responses: + '204': + description: Transcription was successfully requested. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + delete: + tags: + - Recordings + summary: Delete Transcription + description: >- + Deletes the specified recording's transcription. + + + Note: After the deletion is requested and a `204` is returned, the + transcription will not be accessible anymore. However, it is not deleted + immediately. This deletion process, while transparent and irreversible, + can take an additional 24 to 48 hours. + operationId: deleteCallTranscription + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/callId' + - $ref: '#/components/parameters/recordingId' + responses: + '204': + description: The transcription was successfully deleted. + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/statistics: + get: + tags: + - Statistics + summary: Get Account Statistics + description: Returns details about the current state of the account. + operationId: getStatistics + parameters: + - $ref: '#/components/parameters/accountId' + responses: + '200': + $ref: '#/components/responses/getStatisticsResponse' + '400': + $ref: '#/components/responses/voiceBadRequestError' + '401': + $ref: '#/components/responses/voiceUnauthorizedError' + '403': + $ref: '#/components/responses/voiceForbiddenError' + '404': + $ref: '#/components/responses/voiceNotFoundError' + '405': + $ref: '#/components/responses/voiceNotAllowedError' + '415': + $ref: '#/components/responses/voiceUnsupportedMediaTypeError' + '429': + $ref: '#/components/responses/voiceTooManyRequestsError' + '500': + $ref: '#/components/responses/voiceInternalServerError' + servers: *ref_1 + /accounts/{accountId}/code/voice: + post: + tags: + - MFA + summary: Voice Authentication Code + description: Send an MFA Code via a phone call. + operationId: generateVoiceCode + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/codeRequest' + responses: + '200': + $ref: '#/components/responses/voiceCodeResponse' + '400': + $ref: '#/components/responses/mfaBadRequestError' + '401': + $ref: '#/components/responses/mfaUnauthorizedError' + '403': + $ref: '#/components/responses/mfaForbiddenError' + '500': + $ref: '#/components/responses/mfaInternalServerError' + servers: &ref_2 + - url: https://mfa.bandwidth.com/api/v1 + description: Production + /accounts/{accountId}/code/messaging: + post: + tags: + - MFA + summary: Messaging Authentication Code + description: Send an MFA code via text message (SMS). + operationId: generateMessagingCode + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/codeRequest' + responses: + '200': + $ref: '#/components/responses/messagingCodeResponse' + '400': + $ref: '#/components/responses/mfaBadRequestError' + '401': + $ref: '#/components/responses/mfaUnauthorizedError' + '403': + $ref: '#/components/responses/mfaForbiddenError' + '500': + $ref: '#/components/responses/mfaInternalServerError' + servers: *ref_2 + /accounts/{accountId}/code/verify: + post: + tags: + - MFA + summary: Verify Authentication Code + description: Verify a previously sent MFA code. + operationId: verifyCode + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/codeVerify' + responses: + '200': + $ref: '#/components/responses/verifyCodeResponse' + '400': + $ref: '#/components/responses/mfaBadRequestError' + '401': + $ref: '#/components/responses/mfaUnauthorizedError' + '403': + $ref: '#/components/responses/mfaForbiddenError' + '429': + $ref: '#/components/responses/mfaTooManyRequestsError' + '500': + $ref: '#/components/responses/mfaInternalServerError' + servers: *ref_2 + /accounts/{accountId}/tnlookup: + post: + summary: Create Lookup + description: Create a Phone Number Lookup Request. + operationId: createLookup + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId' + requestBody: + $ref: '#/components/requestBodies/createLookupRequest' + responses: + '202': + $ref: '#/components/responses/createLookupResponse' + '400': + $ref: '#/components/responses/tnLookupBadRequestError' + '401': + $ref: '#/components/responses/tnLookupUnauthorizedError' + '403': + $ref: '#/components/responses/tnLookupForbiddenError' + '415': + $ref: '#/components/responses/tnLookupMediaTypeError' + '429': + $ref: '#/components/responses/tnLookupTooManyRequestsError' + '500': + $ref: '#/components/responses/tnLookupInternalServerError' + servers: &ref_3 + - url: https://numbers.bandwidth.com/api/v1 + description: Production + /accounts/{accountId}/tnlookup/{requestId}: + get: + summary: Get Lookup Request Status + description: Get an existing Phone Number Lookup Request. + operationId: getLookupStatus + tags: + - Phone Number Lookup + parameters: + - $ref: '#/components/parameters/accountId' + - $ref: '#/components/parameters/requestId' + responses: + '200': + $ref: '#/components/responses/getLookupResponse' + '400': + $ref: '#/components/responses/tnLookupBadRequestError' + '401': + $ref: '#/components/responses/tnLookupUnauthorizedError' + '403': + $ref: '#/components/responses/tnLookupForbiddenError' + '404': + description: Not Found + '429': + $ref: '#/components/responses/tnLookupTooManyRequestsError' + '500': + $ref: '#/components/responses/tnLookupInternalServerError' + servers: *ref_3 +components: + schemas: + priorityEnum: + type: string + description: |- + The priority specified by the user. + + Not supported on MMS. + enum: + - default + - high + example: default + messageStatusEnum: + type: string + description: >- + The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED + DELIVERED ACCEPTED UNDELIVERED. + enum: + - RECEIVED + - QUEUED + - SENDING + - SENT + - FAILED + - DELIVERED + - ACCEPTED + - UNDELIVERED + example: RECEIVED + listMessageDirectionEnum: + type: string + description: The direction of the message. One of INBOUND OUTBOUND. + enum: + - INBOUND + - OUTBOUND + messageDirectionEnum: + type: string + description: The direction of the message. One of in out. + enum: + - in + - out + messageTypeEnum: + type: string + description: The type of message. Either SMS or MMS. + enum: + - sms + - mms + example: sms + fieldError: + type: object + properties: + fieldName: + type: string + description: The name of the field that contains the error + example: from + description: + type: string + description: The error associated with the field + example: >- + '+invalid' must be replaced with a valid E164 formatted telephone + number + messagesList: + title: MessagesList + type: object + properties: + totalCount: + type: integer + description: >- + The total number of messages matched by the search. When the request + has limitTotalCount set to true this value is limited to 10,000. + example: 100 + pageInfo: + $ref: '#/components/schemas/pageInfo' + messages: + type: array + items: + $ref: '#/components/schemas/listMessageItem' + listMessageItem: + title: listMessageItem + type: object + properties: + messageId: + type: string + description: The message id + example: 1589228074636lm4k2je7j7jklbn2 + accountId: + type: string + description: The account id associated with this message. + example: '9900000' + sourceTn: + type: string + description: The source phone number of the message. + example: '+15554443333' + destinationTn: + type: string + description: The recipient phone number of the message. + example: '+15554442222' + messageStatus: + $ref: '#/components/schemas/messageStatusEnum' + messageDirection: + $ref: '#/components/schemas/listMessageDirectionEnum' + messageType: + $ref: '#/components/schemas/messageTypeEnum' + segmentCount: + type: integer + description: The number of segments the message was sent as. + example: 1 + errorCode: + type: integer + description: The numeric error code of the message. + example: 9902 + receiveTime: + type: string + format: date-time + description: The ISO 8601 datetime of the message. + example: 2020-04-07T14:03:07.000Z + carrierName: + type: string + nullable: true + description: >- + The name of the carrier. Not currently supported for MMS coming + soon. + example: other + messageSize: + type: integer + description: The size of the message including message content and headers. + nullable: true + example: 27 + messageLength: + type: integer + description: The length of the message content. + example: 18 + attachmentCount: + type: integer + description: The number of attachments the message has. + nullable: true + example: 1 + recipientCount: + type: integer + description: The number of recipients the message has. + nullable: true + example: 1 + campaignClass: + type: string + description: The campaign class of the message if it has one. + nullable: true + example: T + campaignId: + type: string + description: The campaign ID of the message if it has one. + nullable: true + example: CJEUMDK + pageInfo: + title: PageInfo + type: object + properties: + prevPage: + type: string + description: The link to the previous page for pagination. + example: >- + https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&nextPage=DLAPE902 + nextPage: + type: string + description: The link to the next page for pagination. + example: >- + https://messaging.bandwidth.com/api/v2/users/accountId/messages?messageStatus=DLR_EXPIRED&prevPage=GL83PD3C + prevPageToken: + type: string + description: The isolated pagination token for the previous page. + example: DLAPE902 + nextPageToken: + type: string + description: The isolated pagination token for the next page. + example: GL83PD3C + messagingRequestError: + title: MessagingRequestError + type: object + properties: + type: + type: string + description: + type: string + required: + - type + - description + createMessageRequestError: + title: CreateMessageRequestError + type: object + properties: + type: + type: string + description: + type: string + fieldErrors: + type: array + items: + $ref: '#/components/schemas/fieldError' + required: + - type + - description + media: + title: Media + type: object + properties: + content: + type: string + contentLength: + type: integer + mediaName: + type: string + tag: + title: Tag + type: object + properties: + key: + type: string + value: + type: string + deferredResult: + title: DeferredResult + type: object + properties: + result: + type: object + setOrExpired: + type: boolean + message: + title: Message + type: object + properties: + id: + type: string + description: The id of the message. + example: 1589228074636lm4k2je7j7jklbn2 + owner: + type: string + description: The Bandwidth phone number associated with the message. + example: '+15554443333' + applicationId: + type: string + description: The application ID associated with the message. + example: 93de2206-9669-4e07-948d-329f4b722ee2 + time: + type: string + format: date-time + description: The datetime stamp of the message in ISO 8601 + example: 2022-09-14T18:20:16.000Z + segmentCount: + type: integer + description: >- + The number of segments the original message from the user is broken + into before sending over to carrier networks. + example: 2 + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + uniqueItems: true + type: array + items: + type: string + description: The phone number recipients of the message. + example: + - '+15552223333' + from: + type: string + description: The phone number the message was sent from. + example: '+15553332222' + media: + uniqueItems: true + type: array + items: + type: string + description: >- + The list of media URLs sent in the message. Including a `filename` + field in the `Content-Disposition` header of the media linked with a + URL will set the displayed file name. This is a best practice to + ensure that your media has a readable file name. + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + text: + type: string + description: The contents of the message. + example: Hello world + tag: + type: string + description: The custom string set by the user. + example: custom tag + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + type: string + format: date-time + description: The expiration date-time set by the user. + example: '2021-02-01T11:29:18-05:00' + messageRequest: + title: MessageRequest + type: object + required: + - applicationId + - to + - from + properties: + applicationId: + type: string + description: >- + The ID of the Application your from number is associated with in the + Bandwidth Phone Number Dashboard. + example: 93de2206-9669-4e07-948d-329f4b722ee2 + to: + uniqueItems: true + type: array + description: The phone number(s) the message should be sent to in E164 format. + example: + - '+15554443333' + - '+15552223333' + items: + type: string + from: + type: string + description: >- + One of your telephone numbers the message should come from in E164 + format. + example: '+15551113333' + text: + type: string + description: The contents of the text message. Must be 2048 characters or less. + maxLength: 2048 + example: Hello world + media: + type: array + items: + type: string + format: uri + maxLength: 4096 + description: >- + A list of URLs to include as media attachments as part of the + message. + + Each URL can be at most 4096 characters. + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + tag: + type: string + description: >- + A custom string that will be included in callback events of the + message. Max 1024 characters. + example: custom string + priority: + $ref: '#/components/schemas/priorityEnum' + expiration: + type: string + format: date-time + description: >- + A string with the date/time value that the message will + automatically expire by. This must be a valid RFC-3339 value, e.g., + 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a + date-time in the future. + + Not supported on MMS. + example: '2021-02-01T11:29:18-05:00' + inboundMessageCallback: + description: Inbound Message Callback + type: object + properties: + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + type: + type: string + example: message-received + to: + type: string + example: '+15552223333' + description: + type: string + example: Incoming message received + message: + $ref: '#/components/schemas/inboundMessageCallbackMessage' + required: + - time + - type + - to + - description + - message + inboundMessageCallbackMessage: + description: Inbound Message Callback Message Schema + type: object + properties: + id: + type: string + example: 1661365814859loidf7mcwd4qacn7 + owner: + type: string + example: '+15553332222' + applicationId: + type: string + example: 93de2206-9669-4e07-948d-329f4b722ee2 + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + segmentCount: + type: integer + example: 1 + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + uniqueItems: true + type: array + items: + type: string + example: + - '+15552223333' + from: + type: string + example: '+15553332222' + text: + type: string + example: Hello world + tag: + type: string + example: custom string + media: + type: array + items: + type: string + format: uri + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + - text + messageSendingCallback: + type: object + description: Message Sending Callback + properties: + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + type: + type: string + example: message-sending + to: + type: string + example: '+15552223333' + description: + type: string + example: Message is sending to carrier + message: + $ref: '#/components/schemas/messageSendingCallbackMessage' + required: + - time + - type + - to + - description + - message + messageSendingCallbackMessage: + description: Message Sending Callback Message Schema + type: object + properties: + id: + type: string + example: 1661365814859loidf7mcwd4qacn7 + owner: + type: string + example: '+15553332222' + applicationId: + type: string + example: 93de2206-9669-4e07-948d-329f4b722ee2 + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + segmentCount: + type: integer + example: 1 + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + uniqueItems: true + type: array + items: + type: string + example: + - '+15552223333' + from: + type: string + example: '+15553332222' + text: + type: string + example: Hello world + tag: + type: string + example: custom string + media: + type: array + items: + type: string + format: uri + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + - text + - media + - priority + messageDeliveredCallback: + description: Message Delivered Callback + type: object + properties: + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + type: + type: string + example: message-delivered + to: + type: string + example: '+15552223333' + description: + type: string + example: Message delivered to carrier. + message: + $ref: '#/components/schemas/messageDeliveredCallbackMessage' + required: + - time + - type + - to + - description + - message + messageDeliveredCallbackMessage: + description: Message Delivered Callback Message Schema + type: object + properties: + id: + type: string + example: 1661365814859loidf7mcwd4qacn7 + owner: + type: string + example: '+15553332222' + applicationId: + type: string + example: 93de2206-9669-4e07-948d-329f4b722ee2 + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + segmentCount: + type: integer + example: 1 + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + uniqueItems: true + type: array + items: + type: string + example: + - '+15552223333' + from: + type: string + example: '+15553332222' + text: + type: string + example: Hello world + tag: + type: string + example: custom string + media: + type: array + items: + type: string + format: uri + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + - text + - tag + messageFailedCallback: + description: Message Failed Callback + type: object + properties: + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + type: + type: string + example: message-failed + to: + type: string + example: '+15552223333' + description: + type: string + example: rejected-unallocated-from-number + message: + $ref: '#/components/schemas/messageFailedCallbackMessage' + errorCode: + type: integer + example: 9902 + required: + - time + - type + - to + - description + - message + - errorCode + messageFailedCallbackMessage: + description: Message Failed Callback Message Schema + type: object + properties: + id: + type: string + example: 1661365814859loidf7mcwd4qacn7 + owner: + type: string + example: '+15553332222' + applicationId: + type: string + example: 93de2206-9669-4e07-948d-329f4b722ee2 + time: + type: string + format: date-time + example: 2016-09-14T18:20:16.000Z + segmentCount: + type: integer + example: 1 + direction: + $ref: '#/components/schemas/messageDirectionEnum' + to: + uniqueItems: true + type: array + items: + type: string + example: + - '+15552223333' + from: + type: string + example: '+15553332222' + text: + type: string + example: Hello world + tag: + type: string + example: custom string + media: + type: array + items: + type: string + format: uri + example: + - https://dev.bandwidth.com/images/bandwidth-logo.png + - https://dev.bandwidth.com/images/github_logo.png + priority: + $ref: '#/components/schemas/priorityEnum' + required: + - id + - owner + - applicationId + - time + - segmentCount + - direction + - to + - from + - text + - tag + - priority + callbackMethodEnum: + type: string + nullable: true + default: POST + enum: + - GET + - POST + description: >- + The HTTP method to use to deliver the callback. GET or POST. Default + value is POST. + example: POST + redirectMethodEnum: + type: string + nullable: true + default: POST + enum: + - GET + - POST + description: >- + The HTTP method to use for the request to `redirectUrl`. GET + + or POST. Default value is POST.

Not allowed if `state` is + `completed`. + example: POST + recordingStateEnum: + type: string + enum: + - paused + - recording + description: |- + The recording state. Possible values: + + `paused` to pause an active recording + + `recording` to resume a paused recording + example: paused + callDirectionEnum: + type: string + enum: + - inbound + - outbound + description: The direction of the call. + example: inbound + fileFormatEnum: + type: string + enum: + - mp3 + - wav + description: The format that the recording is stored in. + example: wav + callStateEnum: + nullable: true + type: string + default: active + enum: + - active + - completed + description: >- + The call state. Possible values:
`active` to redirect the + + call (default)
`completed` to hang up the call if it is answered, + cancel + + it if it is an unanswered outbound call, or reject it if it an + unanswered + + inbound call + example: completed + conferenceStateEnum: + nullable: true + type: string + default: active + enum: + - active + - completed + description: >- + Setting the conference state to `completed` ends the conference and + ejects all members. + example: completed + machineDetectionModeEnum: + type: string + default: async + enum: + - sync + - async + description: >- + The machine detection mode. If set to 'async', the detection + + result will be sent in a 'machineDetectionComplete' callback. If set to + + 'sync', the 'answer' callback will wait for the machine detection to + complete + + and will include its result. + example: async + createCall: + type: object + required: + - answerUrl + - applicationId + - from + - to + properties: + to: + type: string + description: >- + The destination to call (must be an E.164 formatted number + + (e.g. `+15555551212`) or a SIP URI (e.g. + `sip:user@server.example`)). + example: '+19195551234' + from: + type: string + description: >- + A Bandwidth phone number on your account the call should come + + from (must be in E.164 format, like `+15555551212`, or be one of the + following + + strings: `Restricted`, `Anonymous`, `Private`, or `Unavailable`). + example: '+19195554321' + displayName: + nullable: true + type: string + description: >- + The caller display name to use when the call is created. + + May not exceed 256 characters nor contain control characters such as + new lines. + maxLength: 256 + example: John Doe + uui: + nullable: true + type: string + example: >- + eyJhbGciOiJIUzI1NiJ9.WyJoaSJd.-znkjYyCkgz4djmHUPSXl9YrJ6Nix_XvmlwKGFh5ERM;encoding=jwt,aGVsbG8gd29ybGQ;encoding=base64 + description: >- + A comma-separated list of 'User-To-User' headers to be sent + + in the INVITE when calling a SIP URI. Each value must end with an + 'encoding' + + parameter as described in RFC + + 7433. Only 'jwt' and 'base64' encodings are allowed. The entire + value + + cannot exceed 350 characters, including parameters and separators. + applicationId: + type: string + description: The id of the application associated with the `from` number. + example: 1234-qwer-5679-tyui + answerUrl: + type: string + format: uri + description: >- + The full URL to send the Answer + + event to when the called party answers. This endpoint should return + the + + first BXML document to be executed in + the + + call. + + + Must use `https` if specifying `username` and `password`. + maxLength: 2048 + example: https://www.myCallbackServer.example/webhooks/answer + answerMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + answerFallbackUrl: + nullable: true + type: string + format: uri + description: >- + A fallback url which, if provided, will be used to retry the + + `answer` webhook delivery in case `answerUrl` fails to respond + + + Must use `https` if specifying `fallbackUsername` and + `fallbackPassword`. + maxLength: 2048 + example: https://www.myFallbackServer.example/webhooks/answer + answerFallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + fallbackUsername: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + fallbackPassword: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + disconnectUrl: + nullable: true + type: string + format: uri + description: >- + The URL to send the Disconnect event to when + the call ends. This event does not expect a BXML response. + maxLength: 2048 + example: https://www.myCallbackServer.example/webhooks/disconnect + disconnectMethod: + $ref: '#/components/schemas/callbackMethodEnum' + callTimeout: + nullable: true + type: number + format: double + description: >- + The timeout (in seconds) for the callee to answer the call + + after it starts ringing. If the call does not start ringing within + 30s, + + the call will be cancelled regardless of this value. Can be any + numeric + + value (including decimals) between 1 and 300. + minimum: 1 + maximum: 300 + default: 30 + example: 30 + callbackTimeout: + nullable: true + type: number + format: double + description: >- + This is the timeout (in seconds) to use when delivering webhooks + + for the call. Can be any numeric value (including decimals) between + 1 + + and 25. + minimum: 1 + maximum: 25 + default: 15 + example: 15 + machineDetection: + $ref: '#/components/schemas/machineDetectionConfiguration' + priority: + nullable: true + type: integer + minimum: 1 + maximum: 5 + default: 5 + description: >- + The priority of this call over other calls from your account. For + example, if during a call + + your application needs to place a new call and bridge it with the + current + + call, you might want to create the call with priority 1 so that it + will + + be the next call picked off your queue, ahead of other less time + sensitive + + calls. A lower value means higher priority, so a priority 1 call + takes + + precedence over a priority 2 call. + example: 5 + tag: + nullable: true + type: string + description: >- + A custom string that will be sent with all webhooks for this + + call unless overwritten by a future `` + + verb or `tag` attribute on another verb, or cleared. + + + May be cleared by setting `tag=""` + + + Max length 256 characters. + maxLength: 256 + example: arbitrary text here + createCallResponse: + type: object + required: + - accountId + - answerMethod + - answerUrl + - applicationId + - callId + - callUrl + - disconnectMethod + - from + - to + properties: + applicationId: + type: string + example: 04e88489-df02-4e34-a0ee-27a91849555f + description: The id of the application associated with the `from` number. + accountId: + type: string + example: '9900000' + description: The bandwidth account ID associated with the call. + callId: + type: string + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + description: Programmable Voice API Call ID. + to: + type: string + example: '+19195551234' + description: Recipient of the outgoing call. + from: + type: string + example: '+19195554321' + description: Phone number that created the outbound call. + enqueuedTime: + nullable: true + type: string + format: date-time + description: The time at which the call was accepted into the queue. + example: '2022-06-16T13:15:07.160Z' + callUrl: + type: string + format: uri + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + description: The URL to update this call's state. + callTimeout: + type: number + format: double + example: 30 + description: >- + The timeout (in seconds) for the callee to answer the call after it + starts ringing. + callbackTimeout: + type: number + format: double + example: 15 + description: >- + This is the timeout (in seconds) to use when delivering webhooks for + the call. + tag: + nullable: true + type: string + example: My custom tag value + description: Custom tag value. + answerMethod: + $ref: '#/components/schemas/callbackMethodEnum' + answerUrl: + type: string + format: uri + example: https://myServer.example/bandwidth/webhooks/answer + description: URL to deliver the `answer` event webhook. + answerFallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + answerFallbackUrl: + nullable: true + type: string + format: uri + example: https://myFallbackServer.example/bandwidth/webhooks/answer + description: Fallback URL to deliver the `answer` event webhook. + disconnectMethod: + $ref: '#/components/schemas/callbackMethodEnum' + disconnectUrl: + nullable: true + type: string + format: uri + example: https://myServer.example/bandwidth/webhooks/disconnect + description: URL to deliver the `disconnect` event webhook. + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + fallbackUsername: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + fallbackPassword: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + priority: + nullable: true + type: integer + example: 5 + description: The priority of this call over other calls from your account. + callState: + type: object + properties: + applicationId: + type: string + description: The application id associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + accountId: + type: string + description: The account id associated with the call. + example: '9900000' + callId: + type: string + description: The programmable voice API call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + parentCallId: + nullable: true + type: string + description: >- + The A-leg call id, set only if this call is the B-leg of a + [``](/docs/voice/bxml/transfer). + example: c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + to: + type: string + description: >- + The phone number that received the call, in E.164 format (e.g. + +15555555555), or if the call was to a SIP URI, the SIP URI. + example: '+19195551234' + from: + type: string + description: >- + The phone number that made the call, in E.164 format (e.g. + +15555555555). + example: '19195554321' + direction: + $ref: '#/components/schemas/callDirectionEnum' + state: + description: >- + The current state of the call. Current possible values are + + `queued`, `initiated`, `answered` and `disconnected`. Additional + states + + may be added in the future, so your application must be tolerant of + unknown + + values. + type: string + example: disconnected + stirShaken: + nullable: true + type: object + description: >- + For inbound calls, the Bandwidth STIR/SHAKEN implementation will + verify the information provided in the inbound invite request + `Identity` header. + + The verification status is stored in the call state `stirShaken` + property as follows. + + + | Property | Description | + + |:------------------|:------------| + + | verstat | (optional) The verification status indicating whether + the verification was successful or not. Possible values are + `TN-Verification-Passed` or `TN-Verification-Failed`. | + + | attestationIndicator | (optional) The attestation level verified + by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` + (gateway). | + + | originatingId | (optional) A unique origination identifier. | + + + Note that these are common properties but that the `stirShaken` + object is free form and can contain other key-value pairs. + + + More information: [Understanding + STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). + additionalProperties: + type: string + example: + verstat: TN-Verification-Passed + attestationIndicator: A + originatingId: abc123 + identity: + nullable: true + type: string + description: >- + The value of the `Identity` header from the inbound invite + + request. Only present for inbound calls and if the account is + configured + + to forward this header. + example: >- + eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiaHR0cHM6Ly9idy1zaGFrZW4tY2VydC1wdWIuczMuYW1hem9uYXdzLmNvbS9iYW5kd2lkdGgtc2hha2VuLWNlcnRfMjAyMzA3MTYucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxOTg0MjgyMDI4MCJdfSwiaWF0IjoxNjU2NTM0MzM2LCJvcmlnIjp7InRuIjoiMTkxOTQ0NDI2ODMifSwib3JpZ2lkIjoiNDk0NTlhOGEtNDJmNi0zNTFjLTkzNjEtYWRmNTdhOWUwOGNhIn0.56un9sRw_uH-sbJvnUsqdevlVxbOVjn8MVlGTlBMicjaZuRRwxfiNp-C9zYCMKTTCbc-QdYPN05F61XNVN4D3w;info=;alg=ES256;ppt=shaken + enqueuedTime: + nullable: true + type: string + format: date-time + description: The time this call was placed in queue. + example: '2022-06-16T13:15:07.160Z' + startTime: + nullable: true + type: string + format: date-time + description: >- + The time the call was initiated, in ISO 8601 format. `null` if the + call is still in your queue. + example: '2022-06-16T13:15:07.160Z' + answerTime: + nullable: true + type: string + format: date-time + description: >- + Populated once the call has been answered, with the time in ISO 8601 + format. + example: '2022-06-16T13:15:18.126Z' + endTime: + nullable: true + type: string + format: date-time + description: Populated once the call has ended, with the time in ISO 8601 format. + example: '2022-06-16T13:15:18.314Z' + disconnectCause: + nullable: true + type: string + description: >- + | Cause | Description | + + |:------|:------------| + + | `hangup`| One party hung up the call, a + [``](../../bxml/verbs/hangup.md) verb was executed, or there + was no more BXML to execute; it indicates that the call ended + normally. | + + | `busy` | Callee was busy. | + + | `timeout` | Call wasn't answered before the `callTimeout` was + reached. | + + | `cancel` | Call was cancelled by its originator while it was + ringing. | + + | `rejected` | Call was rejected by the callee. | + + | `callback-error` | BXML callback couldn't be delivered to your + callback server. | + + | `invalid-bxml` | Invalid BXML was returned in response to a + callback. | + + | `application-error` | An unsupported action was tried on the call, + e.g. trying to play a .ogg audio. | + + | `account-limit` | Account rate limits were reached. | + + | `node-capacity-exceeded` | System maximum capacity was reached. | + + | `error` | Some error not described in any of the other causes + happened on the call. | + + | `unknown` | Unknown error happened on the call. | + + + Note: This list is not exhaustive and other values can appear in the + future. + errorMessage: + nullable: true + type: string + description: >- + Populated only if the call ended with an error, with text explaining + the reason. + example: null + errorId: + nullable: true + type: string + description: >- + Populated only if the call ended with an error, with a Bandwidth + internal id that references the error event. + example: null + lastUpdate: + type: string + format: date-time + description: The last time the call had a state update, in ISO 8601 format. + example: '2022-06-16T13:15:18.314Z' + updateCall: + type: object + properties: + state: + $ref: '#/components/schemas/callStateEnum' + redirectUrl: + description: |- + The URL to send the [Redirect](/docs/voice/bxml/redirect) event + to which will provide new BXML. + + Required if `state` is `active`. + + Not allowed if `state` is `completed`. + nullable: true + type: string + format: uri + example: https://myServer.example/bandwidth/webhooks/redirect + redirectMethod: + $ref: '#/components/schemas/redirectMethodEnum' + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + redirectFallbackUrl: + nullable: true + type: string + format: uri + description: |- + A fallback url which, if provided, will be used to retry the + redirect callback delivery in case `redirectUrl` fails to respond. + example: https://myFallbackServer.example/bandwidth/webhooks/redirect + redirectFallbackMethod: + $ref: '#/components/schemas/redirectMethodEnum' + fallbackUsername: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + fallbackPassword: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + tag: + nullable: true + type: string + description: >- + A custom string that will be sent with this and all future + + callbacks unless overwritten by a future `tag` attribute or + [``](/docs/voice/bxml/tag) + + verb, or cleared. + + + May be cleared by setting `tag=""`. + + + Max length 256 characters. + + + Not allowed if `state` is `completed`. + maxLength: 256 + example: My Custom Tag + updateCallRecording: + type: object + required: + - state + properties: + state: + $ref: '#/components/schemas/recordingStateEnum' + accountStatistics: + type: object + properties: + currentCallQueueSize: + type: integer + description: The number of calls currently enqueued. + example: 0 + maxCallQueueSize: + type: integer + description: >- + The maximum size of the queue before outgoing calls start being + rejected. + example: 900 + callRecordingMetadata: + type: object + properties: + applicationId: + $ref: '#/components/schemas/applicationId' + accountId: + $ref: '#/components/schemas/accountId' + callId: + $ref: '#/components/schemas/callId' + parentCallId: + $ref: '#/components/schemas/parentCallId' + recordingId: + $ref: '#/components/schemas/recordingId' + to: + $ref: '#/components/schemas/to' + from: + $ref: '#/components/schemas/from' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + duration: + $ref: '#/components/schemas/duration' + direction: + $ref: '#/components/schemas/callDirectionEnum' + channels: + $ref: '#/components/schemas/channels' + startTime: + $ref: '#/components/schemas/startTime' + endTime: + $ref: '#/components/schemas/endTime' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + status: + $ref: '#/components/schemas/status' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + transcription: + $ref: '#/components/schemas/transcriptionMetadata' + conference: + type: object + properties: + id: + type: string + description: The Bandwidth-generated conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: + type: string + description: The name of the conference, as specified by your application. + example: my-conference-name + createdTime: + type: string + format: date-time + description: The time the conference was initiated, in ISO 8601 format. + example: '2022-06-17T22:19:40.375Z' + completedTime: + nullable: true + type: string + format: date-time + description: The time the conference was terminated, in ISO 8601 format. + example: '2022-06-17T22:20:00.000Z' + conferenceEventUrl: + nullable: true + type: string + format: uri + description: The URL to send the conference-related events. + example: https://myServer.example/bandwidth/webhooks/conferenceEvent + conferenceEventMethod: + $ref: '#/components/schemas/callbackMethodEnum' + tag: + nullable: true + type: string + description: >- + The custom string attached to the conference that will be sent with + callbacks. + example: my custom tag + activeMembers: + type: array + nullable: true + items: + $ref: '#/components/schemas/conferenceMember' + description: >- + A list of active members of the conference. Omitted if this + + is a response to the [Get Conferences + endpoint](/apis/voice#tag/Conferences/operation/listConferences). + updateConference: + type: object + properties: + status: + $ref: '#/components/schemas/conferenceStateEnum' + redirectUrl: + nullable: true + type: string + format: uri + description: >- + The URL to send the + [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) + + event which will provide new BXML. Not allowed if `state` is + `completed`, + + but required if `state` is `active`. + example: https://myServer.example/bandwidth/webhooks/conferenceRedirect + redirectMethod: + $ref: '#/components/schemas/redirectMethodEnum' + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + redirectFallbackUrl: + nullable: true + type: string + format: uri + description: >- + A fallback url which, if provided, will be used to retry the + + `conferenceRedirect` webhook delivery in case `redirectUrl` fails to + respond. Not + + allowed if `state` is `completed`. + example: >- + https://myFallbackServer.example/bandwidth/webhooks/conferenceRedirect + redirectFallbackMethod: + $ref: '#/components/schemas/redirectMethodEnum' + fallbackUsername: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + fallbackPassword: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + conferenceMember: + type: object + properties: + callId: + $ref: '#/components/schemas/callId' + conferenceId: + $ref: '#/components/schemas/conferenceId' + memberUrl: + type: string + description: >- + A URL that may be used to retrieve information about or update + + the state of this conference member. This is the URL of this + member's + + [Get Conference Member](/apis/voice/#operation/getConferenceMember) + endpoint + + and [Modify Conference + Member](/apis/voice/#operation/updateConferenceMember) + + endpoint. + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/members/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + mute: + type: boolean + description: >- + Whether or not this member is currently muted. Members who are muted + are still able to hear other participants. + + + If used in a PUT request, updates this member's mute status. Has no + effect if omitted. + example: false + hold: + type: boolean + description: >- + Whether or not this member is currently on hold. Members who are on + hold are not able to hear or speak in the conference. + + + If used in a PUT request, updates this member's hold status. Has no + effect if omitted. + example: false + callIdsToCoach: + nullable: true + type: array + items: + type: string + description: >- + If this member had a value set for `callIdsToCoach` in its + [Conference](/docs/voice/bxml/conference) verb or this list was + added with a previous PUT request to modify the member, this is that + list of calls. + + + If present in a PUT request, modifies the calls that this member is + coaching. Has no effect if omitted. See the documentation for the + [Conference](/docs/voice/bxml/conference) verb for more details + about coaching. + + Note that this will not add the matching calls to the conference; + each call must individually execute a Conference verb to join. + example: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + updateConferenceMember: + type: object + properties: + mute: + type: boolean + description: >- + Whether or not this member is currently muted. Members who are muted + are still able to hear other participants. + + + Updates this member's mute status. Has no effect if omitted. + example: false + hold: + type: boolean + description: >- + Whether or not this member is currently on hold. Members who are on + hold are not able to hear or speak in the conference. + + + Updates this member's hold status. Has no effect if omitted. + example: false + callIdsToCoach: + nullable: true + type: array + items: + type: string + description: >- + If this member had a value set for `callIdsToCoach` in its + [Conference](/docs/voice/bxml/conference) verb or this list was + added with a previous PUT request to modify the member, this is that + list of calls. + + + Modifies the calls that this member is coaching. Has no effect if + omitted. See the documentation for the + [Conference](/docs/voice/bxml/conference) verb for more details + about coaching. + + + Note that this will not add the matching calls to the conference; + each call must individually execute a Conference verb to join. + example: + - c-25ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + conferenceRecordingMetadata: + type: object + properties: + accountId: + $ref: '#/components/schemas/accountId' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + recordingId: + $ref: '#/components/schemas/recordingId' + duration: + $ref: '#/components/schemas/duration' + channels: + $ref: '#/components/schemas/channels' + startTime: + $ref: '#/components/schemas/startTime' + endTime: + $ref: '#/components/schemas/endTime' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + status: + $ref: '#/components/schemas/status' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + machineDetectionConfiguration: + type: object + description: >- + The machine detection request used to perform machine detection on the + call. + properties: + mode: + $ref: '#/components/schemas/machineDetectionModeEnum' + detectionTimeout: + nullable: true + type: number + format: double + description: >- + The timeout used for the whole operation, in seconds. If no + + result is determined in this period, a callback with a `timeout` + result + + is sent. + default: 15 + example: 15 + silenceTimeout: + nullable: true + type: number + format: double + description: >- + If no speech is detected in this period, a callback with a 'silence' + result is sent. + default: 10 + example: 10 + speechThreshold: + nullable: true + type: number + format: double + description: >- + When speech has ended and a result couldn't be determined based + + on the audio content itself, this value is used to determine if the + speaker + + is a machine based on the speech duration. If the length of the + speech + + detected is greater than or equal to this threshold, the result will + be + + 'answering-machine'. If the length of speech detected is below this + threshold, + + the result will be 'human'. + default: 10 + example: 10 + speechEndThreshold: + nullable: true + type: number + format: double + description: >- + Amount of silence (in seconds) before assuming the callee has + finished speaking. + default: 5 + example: 5 + machineSpeechEndThreshold: + nullable: true + type: number + format: double + description: >- + When an answering machine is detected, the amount of silence (in + seconds) before assuming the message has finished playing. + + If not provided it will default to the speechEndThreshold value. + example: 5 + delayResult: + nullable: true + type: boolean + description: >- + If set to 'true' and if an answering machine is detected, the + + 'answering-machine' callback will be delayed until the machine is + done + + speaking, or an end of message tone is detected, or until the + 'detectionTimeout' is exceeded. If false, the 'answering-machine' + + result is sent immediately. + default: false + example: false + callbackUrl: + nullable: true + description: >- + The URL to send the 'machineDetectionComplete' webhook when the + detection is completed. Only for 'async' mode. + type: string + format: uri + maxLength: 2048 + example: https://myServer.example/bandwidth/webhooks/machineDetectionComplete + callbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + fallbackUrl: + nullable: true + type: string + format: uri + description: >- + A fallback URL which, if provided, will be used to retry the + + machine detection complete webhook delivery in case `callbackUrl` + fails + + to respond + maxLength: 2048 + example: >- + https://myFallbackServer.example/bandwidth/webhooks/machineDetectionComplete + fallbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + fallbackUsername: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + fallbackPassword: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + transcribeRecording: + type: object + properties: + callbackUrl: + type: string + format: uri + description: >- + The URL to send the + [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) + + event to. You should not include sensitive or + personally-identifiable + + information in the callbackUrl field! Always use the proper username + and + + password fields for authorization. + example: https://myServer.example/bandwidth/webhooks/transcriptionAvailable + callbackMethod: + $ref: '#/components/schemas/callbackMethodEnum' + username: + type: string + nullable: true + description: Basic auth username. + maxLength: 1024 + example: mySecretUsername + password: + type: string + nullable: true + description: Basic auth password. + maxLength: 1024 + example: mySecretPassword1! + tag: + $ref: '#/components/schemas/tag1' + callbackTimeout: + nullable: true + type: number + format: double + minimum: 1 + maximum: 25 + default: 15 + description: >- + This is the timeout (in seconds) to use when delivering the + + webhook to `callbackUrl`. Can be any numeric value (including + decimals) + + between 1 and 25. + example: 5.5 + detectLanguage: + type: boolean + nullable: true + description: >- + A boolean value to indicate that the recording may not be in + English, and the transcription service will need to detect the + dominant language the recording is in and transcribe accordingly. + Current supported languages are English, French, and Spanish. + default: false + example: true + transcriptionList: + type: object + properties: + transcripts: + type: array + items: + $ref: '#/components/schemas/transcription' + transcriptionMetadata: + nullable: true + type: object + description: If the recording was transcribed, metadata about the transcription + properties: + id: + type: string + description: The unique transcription ID + example: t-387bd648-18f3-4823-9d16-746bca0003c9 + status: + $ref: '#/components/schemas/status' + completedTime: + type: string + description: The time that the transcription was completed + example: '2022-06-13T18:46:29.715Z' + url: + type: string + format: uri + description: The URL of the [transcription](#operation/getCallTranscription) + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/recordings/r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85/transcription + voiceApiError: + type: object + properties: + type: + type: string + description: + type: string + id: + nullable: true + type: string + answerCallback: + type: object + description: >- + The Answer event is sent to the answerUrl specified in the createCall + request when an outbound call is answered. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + machineDetectionResult: + $ref: '#/components/schemas/machineDetectionResult' + bridgeCompleteCallback: + type: object + description: >- + If the target call leaves the , then this callback is sent to + the bridgeCompleteUrl, and the BXML returned in it is executed on the + call. If this webhook is sent, the Bridge Target Complete webhook is NOT + sent. This callback is also sent if any problem occurs that prevents the + calls to be bridged. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + cause: + $ref: '#/components/schemas/cause' + errorMessage: + $ref: '#/components/schemas/errorMessage' + errorId: + $ref: '#/components/schemas/errorId' + bridgeTargetCompleteCallback: + type: object + description: >- + If the originating call leaves the , then this callback is sent + to the bridgeTargetCompleteUrl, and the BXML returned in it is executed + on the target call. If this webhook is sent, the Bridge Complete webhook + is NOT sent. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + conferenceCreatedCallback: + type: object + description: >- + The Conference Created event is fired whenever a new conference that + specified a callbackUrl is created. The response may be either empty or + a BXML document. Only the following verbs are valid for conferences: + PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, + ResumeRecording. Audio verbs will be heard by all members of the + conference. Recordings capture audio from all members who are not muted + or on hold, as well as any audio verbs that are played into the + conference. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + tag: + $ref: '#/components/schemas/tag1' + conferenceRedirectCallback: + type: object + description: >- + The Conference Redirect event is fired whenever an existing conference + is modified via a POST request made to the /conferences/{conferenceId} + endpoint. The response may be either empty or a BXML document. Only the + following verbs are valid for conferences: PlayAudio, SpeakSentence, + StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio + verbs will be heard by all members of the conference. Recordings capture + audio from all members who are not muted or on hold, as well as any + audio verbs that are played into the conference. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + tag: + $ref: '#/components/schemas/tag1' + conferenceMemberJoinCallback: + type: object + description: >- + The Conference Member Join event is fired whenever a caller joins a + conference that specified a callbackUrl. The response may be either + empty or a BXML document. Only the following verbs are valid for + conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, + PauseRecording, ResumeRecording. Audio verbs will be heard by all + members of the conference. Recordings capture audio from all members who + are not muted or on hold, as well as any audio verbs that are played + into the conference. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + callId: + $ref: '#/components/schemas/callId' + tag: + $ref: '#/components/schemas/tag1' + conferenceMemberExitCallback: + type: object + description: >- + The Conference Member Exit event is fired whenever a caller exits a + conference that specified a callbackUrl. The response may be either + empty or a BXML document. Only the following verbs are valid for + conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, + PauseRecording, ResumeRecording. Audio verbs will be heard by all + members of the conference. Recordings capture audio from all members who + are not muted or on hold, as well as any audio verbs that are played + into the conference. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + callId: + $ref: '#/components/schemas/callId' + tag: + $ref: '#/components/schemas/tag1' + conferenceCompletedCallback: + type: object + description: >- + The Conference Completed event is fired when the last member leaves the + conference. The response to this event may not contain BXML. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + tag: + $ref: '#/components/schemas/tag1' + conferenceRecordingAvailableCallback: + type: object + description: >- + The Conference Recording Available event is sent after a conference + recording has been processed. It indicates that the recording is + available for download. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + conferenceId: + $ref: '#/components/schemas/conferenceId' + name: + $ref: '#/components/schemas/name' + accountId: + $ref: '#/components/schemas/accountId' + recordingId: + $ref: '#/components/schemas/recordingId' + channels: + $ref: '#/components/schemas/channels' + startTime: + $ref: '#/components/schemas/startTime' + endTime: + $ref: '#/components/schemas/endTime' + duration: + $ref: '#/components/schemas/duration' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + tag: + $ref: '#/components/schemas/tag1' + status: + $ref: '#/components/schemas/status' + disconnectCallback: + type: object + description: The Disconnect event is fired when a call ends, for any reason. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + callId: + $ref: '#/components/schemas/callId' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + endTime: + $ref: '#/components/schemas/endTime' + cause: + $ref: '#/components/schemas/cause' + errorMessage: + $ref: '#/components/schemas/errorMessage' + errorId: + $ref: '#/components/schemas/errorId' + tag: + $ref: '#/components/schemas/tag1' + dtmfCallback: + type: object + description: >- + The DTMF event is sent for every digit detected after a + verb is executed. You may not respond to this event with BXML. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + callId: + $ref: '#/components/schemas/callId' + direction: + $ref: '#/components/schemas/callDirectionEnum' + digit: + $ref: '#/components/schemas/digit' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + parentCallId: + $ref: '#/components/schemas/parentCallId' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + tag: + $ref: '#/components/schemas/tag1' + gatherCallback: + type: object + description: >- + The gather event is sent after a verb is executed. Its purpose + is to report the gathered digits to the calling application. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + digits: + $ref: '#/components/schemas/digits' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + parentCallId: + $ref: '#/components/schemas/parentCallId' + terminatingDigit: + $ref: '#/components/schemas/terminatingDigit' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + tag: + $ref: '#/components/schemas/tag1' + initiateCallback: + type: object + description: >- + The Initiate event is fired when an inbound call is received for a + Telephone Number on your Account. It is sent to the URL specified in the + application associated with the location (sip-peer) that the called + telephone number belongs to. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + startTime: + $ref: '#/components/schemas/startTime' + diversion: + $ref: '#/components/schemas/diversion' + stirShaken: + $ref: '#/components/schemas/stirShaken' + machineDetectionCompleteCallback: + type: object + description: >- + This event is sent to the url informed when requesting a machine + detection operation. It contains the machine detection operation result, + which can be: human, answering-machine, silence, timeout, error. This + event is not sent when sync answering machine detection mode is chosen. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + machineDetectionResult: + $ref: '#/components/schemas/machineDetectionResult' + recordingCompleteCallback: + type: object + description: >- + The Record Complete event is sent after a verb has executed if + the call is still active. The BXML returned by this callback is executed + next. When the recording is available for download, a Recording + Available event will be sent. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + parentCallId: + $ref: '#/components/schemas/parentCallId' + recordingId: + $ref: '#/components/schemas/recordingId' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + endTime: + $ref: '#/components/schemas/endTime' + duration: + $ref: '#/components/schemas/duration' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + channels: + $ref: '#/components/schemas/channels' + tag: + $ref: '#/components/schemas/tag1' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + recordingAvailableCallback: + type: object + description: >- + The Recording Available event is sent after a recording has been + processed. It indicates that the recording is available for download. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + parentCallId: + $ref: '#/components/schemas/parentCallId' + recordingId: + $ref: '#/components/schemas/recordingId' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + endTime: + $ref: '#/components/schemas/endTime' + duration: + $ref: '#/components/schemas/duration' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + channels: + $ref: '#/components/schemas/status' + tag: + $ref: '#/components/schemas/tag1' + status: + $ref: '#/components/schemas/status' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + redirectCallback: + type: object + description: >- + The Redirect event is fired when a verb is executed. Its + purpose is to get the next set of verbs from the calling application. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + parentCallId: + $ref: '#/components/schemas/parentCallId' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + transcriptionAvailableCallback: + type: object + description: >- + The Transcription Available event is sent when the recording + transcription is available to be downloaded. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + mediaUrl: + $ref: '#/components/schemas/mediaUrl' + parentCallId: + $ref: '#/components/schemas/parentCallId' + recordingId: + $ref: '#/components/schemas/recordingId' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + endTime: + $ref: '#/components/schemas/endTime' + duration: + $ref: '#/components/schemas/duration' + fileFormat: + $ref: '#/components/schemas/fileFormatEnum' + tag: + $ref: '#/components/schemas/tag1' + transcription: + $ref: '#/components/schemas/transcription' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + transferAnswerCallback: + type: object + description: >- + When processing a verb, this event is sent when a called + party (B-leg) answers. The event is sent to the endpoint specified in + the transferAnswerUrl attribute of the tag that answered. + BXML returned by this callback will be executed for the called party + only. After all BXML has been executed, the called party will be bridged + to the original call. Most BXML verbs are allowed in response to a + transferAnswer event, but some are not allowed. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + transferCompleteCallback: + type: object + description: >- + This event is sent to the transferCompleteUrl of the A-leg's + verb when the transferred call (B-leg) completes. In a simultaneous + ringing scenario, only one B-leg succeeds and this event corresponds to + that successful leg. If none of the calls were answered, the + transferComplete event corresponds to one of the legs. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + tag: + $ref: '#/components/schemas/tag1' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + cause: + $ref: '#/components/schemas/cause' + errorMessage: + $ref: '#/components/schemas/errorMessage' + errorId: + $ref: '#/components/schemas/errorId' + transferDisconnectCallback: + type: object + description: >- + This event is sent to the transferDisconnectUrl of each + tag when its respective call leg ends for any reason. The event is sent + in the normal case, when the transferred leg is answered and later hung + up, but is also sent if the new leg was never answered in the first + place, if it was rejected, and if the original call leg hung up before + the transferred leg. + properties: + eventType: + $ref: '#/components/schemas/eventType' + eventTime: + $ref: '#/components/schemas/eventTime' + accountId: + $ref: '#/components/schemas/accountId' + applicationId: + $ref: '#/components/schemas/applicationId' + from: + $ref: '#/components/schemas/from' + to: + $ref: '#/components/schemas/to' + direction: + $ref: '#/components/schemas/callDirectionEnum' + callId: + $ref: '#/components/schemas/callId' + callUrl: + $ref: '#/components/schemas/callUrl' + parentCallId: + $ref: '#/components/schemas/parentCallId' + enqueuedTime: + $ref: '#/components/schemas/enqueuedTime' + startTime: + $ref: '#/components/schemas/startTime' + answerTime: + $ref: '#/components/schemas/answerTime' + endTime: + $ref: '#/components/schemas/endTime' + tag: + $ref: '#/components/schemas/tag1' + transferCallerId: + $ref: '#/components/schemas/transferCallerId' + transferTo: + $ref: '#/components/schemas/transferTo' + cause: + $ref: '#/components/schemas/cause' + errorMessage: + $ref: '#/components/schemas/errorMessage' + errorId: + $ref: '#/components/schemas/errorId' + eventType: + type: string + description: >- + The event type, value can be one of the following: answer, + bridgeComplete, bridgeTargetComplete, conferenceCreated, + conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, + conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, + gather, initiate, machineDetectionComplete, recordingComplete, + recordingAvailable, redirect, transcriptionAvailable, transferAnswer, + transferComplete, transferDisconnect. + example: bridgeComplete + eventTime: + type: string + format: date-time + description: >- + The approximate UTC date and time when the event was generated by the + Bandwidth server, in ISO 8601 format. This may not be exactly the time + of event execution. + example: '2022-06-17T22:19:40.375Z' + accountId: + type: string + description: The user account associated with the call. + example: '920012' + applicationId: + type: string + description: The id of the application associated with the call. + example: 04e88489-df02-4e34-a0ee-27a91849555f + to: + type: string + description: >- + The phone number that received the call, in E.164 format (e.g. + +15555555555). + example: '+15555555555' + from: + type: string + description: >- + The provided identifier of the caller: can be a phone number in E.164 + format (e.g. +15555555555) or one of Private, Restricted, Unavailable, + or Anonymous. + example: '+15555555555' + conferenceId: + type: string + description: The unique, Bandwidth-generated ID of the conference that was recorded + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: + type: string + description: The user-specified name of the conference that was recorded + example: my-conference-name + recordingId: + type: string + description: The unique ID of this recording + example: r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833 + duration: + type: string + description: The duration of the recording in ISO-8601 format + example: PT13.67S + channels: + type: integer + format: int32 + description: >- + Always `1` for conference recordings; multi-channel recordings are not + supported on conferences. + example: 1 + digit: + type: string + description: The digit collected in the call. + example: '2' + digits: + type: string + description: >- + (optional) The digits, letters, and/or symbols entered by the user. The + string is empty if a timeout occurred before any buttons were pressed. + example: '123' + terminatingDigit: + type: string + description: >- + (optional) The digit the user pressed to end the gather. Empty string + value if no terminating digit was pressed. + example: '#' + startTime: + type: string + format: date-time + description: Time the call was started, in ISO 8601 format. + example: '2022-06-17T22:19:40.375Z' + enqueuedTime: + type: string + format: date-time + description: >- + (optional) If call queueing is enabled and this is an outbound call, + time the call was queued, in ISO 8601 format. + example: '2022-06-17T22:20:00.000Z' + nullable: true + answerTime: + type: string + format: date-time + description: Time the call was answered, in ISO 8601 format. + example: '2022-06-17T22:20:00.000Z' + nullable: true + endTime: + type: string + format: date-time + description: The time that the recording ended in ISO-8601 format + example: '2022-06-17T22:20:00.000Z' + status: + type: string + description: >- + The current status of the process. For recording, current possible + values are 'processing', 'partial', 'complete', 'deleted', and 'error'. + For transcriptions, current possible values are 'none', 'processing', + 'available', 'error', 'timeout', 'file-size-too-big', and + 'file-size-too-small'. Additional states may be added in the future, so + your application must be tolerant of unknown values. + example: completed + transferCallerId: + type: string + description: >- + The phone number used as the from field of the B-leg call, in E.164 + format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or + Unavailable. + example: '+15555555555' + transferTo: + type: string + description: >- + The phone number used as the to field of the B-leg call, in E.164 format + (e.g. +15555555555). + example: +15555555555) + mediaUrl: + nullable: true + type: string + format: uri + description: >- + The URL that can be used to download the recording. Only present if the + recording is finished and may be downloaded. + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/conferences/conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9/recordings/r-fbe05094-9fd2afe9-bf5b-4c68-820a-41a01c1c5833/media + callId: + type: string + description: The call id associated with the event. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callUrl: + type: string + description: The URL of the call associated with the event. + example: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + parentCallId: + type: string + description: >- + (optional) If the event is related to the B leg of a , the + call id of the original call leg that executed the . + Otherwise, this field will not be present. + example: c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d + tag1: + type: string + description: >- + (optional) The tag specified on call creation. If no tag was specified + or it was previously cleared, this field will not be present. + example: exampleTag + nullable: true + cause: + type: string + description: >- + Reason the call failed - hangup, busy, timeout, cancel, rejected, + callback-error, invalid-bxml, application-error, account-limit, + node-capacity-exceeded, error, or unknown. + example: busy + errorMessage: + type: string + description: >- + Text explaining the reason that caused the call to fail in case of + errors. + example: >- + Call c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f is already bridged + with another call + nullable: true + errorId: + type: string + description: Bandwidth's internal id that references the error event. + example: 4642074b-7b58-478b-96e4-3a60955c6765 + nullable: true + machineDetectionResult: + type: object + description: >- + (optional) if machine detection was requested in sync mode, the result + will be specified here. Possible values are the same as the async + counterpart: Machine Detection Complete + properties: + value: + type: string + description: >- + Possible values are answering-machine, human, silence, timeout, or + error. + example: answering-machine + duration: + type: string + description: The amount of time it took to determine the result. + example: PT4.9891287S + nullable: true + diversion: + type: object + properties: + reason: + type: string + description: >- + The reason for the diversion. Common values: unknown, user-busy, + no-answer, unavailable, unconditional, time-of-day, do-not-disturb, + deflection, follow-me, out-of-service, away. + example: unavailable + privacy: + type: string + description: off or full + example: 'off' + screen: + type: string + description: >- + No if the number was provided by the user, yes if the number was + provided by the network + example: 'no' + counter: + type: string + description: The number of diversions that have occurred + example: '2' + limit: + type: string + description: The maximum number of diversions allowed for this session + example: '3' + unknown: + type: string + description: >- + The normal list of values is not exhaustive. Your application must + be tolerant of unlisted keys and unlisted values of those keys. + example: unknownValue + origTo: + type: string + description: >- + Always present. Indicates the last telephone number that the call + was diverted from. + example: '+15558884444' + transcription: + type: object + properties: + text: + type: string + description: The transcribed text + example: Nice talking to you, friend! + confidence: + type: number + format: double + description: >- + The confidence on the recognized content, ranging from `0.0` to + `1.0` with `1.0` being the highest confidence. + example: 0.9 + stirShaken: + type: object + properties: + verstat: + type: string + description: >- + (optional) The verification status indicating whether the + verification was successful or not. Possible values are + TN-Verification-Passed and TN-Verification-Failed. + example: Tn-Verification-Passed + attestationIndicator: + type: string + description: >- + (optional) The attestation level verified by Bandwidth. Possible + values are A (full), B (partial) or C (gateway). + example: A + originatingId: + type: string + description: (optional) A unique origination identifier. + example: 99759086-1335-11ed-9bcf-5f7d464e91af + codeRequest: + type: object + properties: + to: + type: string + description: The phone number to send the mfa code to. + pattern: ^\+[1-9]\d{1,14}$ + example: '+19195551234' + from: + type: string + description: The application phone number, the sender of the mfa code. + pattern: ^\+[1-9]\d{1,14}$ + maxLength: 32 + example: '+19195554321' + applicationId: + type: string + description: The application unique ID, obtained from Bandwidth. + maxLength: 50 + example: 66fd98ae-ac8d-a00f-7fcd-ba3280aeb9b1 + scope: + type: string + description: >- + An optional field to denote what scope or action the mfa code is + addressing. If not supplied, defaults to "2FA". + maxLength: 25 + example: 2FA + message: + type: string + description: >- + The message format of the mfa code. There are three values that the + system will replace "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" + and "{NAME} value template are optional, while "{CODE}" must be + supplied. As the name would suggest, code will be replace with the + actual mfa code. Name is replaced with the application name, + configured during provisioning of mfa. The scope value is the same + value sent during the call and partitioned by the server. + maxLength: 2048 + example: Your temporary {NAME} {SCOPE} code is {CODE} + digits: + type: integer + description: >- + The number of digits for your mfa code. The valid number ranges + from 2 to 8, inclusively. + minimum: 4 + maximum: 8 + example: 6 + required: + - to + - from + - applicationId + - message + - digits + voiceCodeResponse: + type: object + properties: + callId: + type: string + description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + messagingCodeResponse: + type: object + properties: + messageId: + type: string + description: Messaging API Message ID. + example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + verifyCodeRequest: + type: object + properties: + to: + type: string + description: The phone number to send the mfa code to. + pattern: ^\+[1-9]\d{1,14}$ + example: '+19195551234' + scope: + type: string + description: >- + An optional field to denote what scope or action the mfa code is + addressing. If not supplied, defaults to "2FA". + example: 2FA + expirationTimeInMinutes: + type: number + description: >- + The time period, in minutes, to validate the mfa code. By setting + this to 3 minutes, it will mean any code generated within the last 3 + minutes are still valid. The valid range for expiration time is + between 0 and 15 minutes, exclusively and inclusively, respectively. + minimum: 1 + maximum: 15 + example: 3 + code: + type: string + description: The generated mfa code to check if valid. + minLength: 4 + maxLength: 8 + example: '123456' + required: + - to + - expirationTimeInMinutes + - code + verifyCodeResponse: + type: object + properties: + valid: + type: boolean + description: Whether or not the supplied code is valid. + example: true + mfaRequestError: + type: object + properties: + error: + type: string + description: A message describing the error with your request. + example: 400 Request is malformed or invalid + requestId: + type: string + description: The associated requestId from AWS. + example: 354cc8a3-6701-461e-8fa7-8671703dd898 + mfaUnauthorizedRequestError: + type: object + properties: + message: + type: string + description: Unauthorized + example: Unauthorized + mfaForbiddenRequestError: + type: object + properties: + message: + type: string + description: >- + The message containing the reason behind the request being + forbidden. + example: Missing Authentication Token + lookupStatusEnum: + type: string + description: >- + The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or + FAILED). + enum: + - IN_PROGRESS + - COMPLETE + - PARTIAL_COMPLETE + - FAILED + example: COMPLETE + lookupRequest: + type: object + description: Create phone number lookup request. + properties: + tns: + type: array + items: + type: string + required: + - tns + createLookupResponse: + type: object + description: >- + The request has been accepted for processing but not yet finished and in + a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). + properties: + requestId: + type: string + description: The phone number lookup request ID from Bandwidth. + status: + $ref: '#/components/schemas/lookupStatusEnum' + lookupStatus: + type: object + description: >- + If requestId exists, the result for that request is returned. See the + Examples for details on the various responses that you can receive. + Generally, if you see a Response Code of 0 in a result for a TN, + information will be available for it. Any other Response Code will + indicate no information was available for the TN. + properties: + requestId: + type: string + description: The requestId. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + status: + $ref: '#/components/schemas/lookupStatusEnum' + result: + type: array + description: The carrier information results for the specified telephone number. + items: + $ref: '#/components/schemas/lookupResult' + failedTelephoneNumbers: + type: array + description: The telephone numbers whose lookup failed. + items: + type: string + example: + - '+191955512345' + lookupResult: + type: object + description: Carrier information results for the specified telephone number. + properties: + Response Code: + type: integer + description: Our vendor's response code. + example: 0 + Message: + type: string + description: Message associated with the response code. + example: NOERROR + E.164 Format: + type: string + description: The telephone number in E.164 format. + example: '+19195551234' + Formatted: + type: string + description: The formatted version of the telephone number. + example: (919) 555-1234 + Country: + type: string + description: The country of the telephone number. + example: US + Line Type: + type: string + description: The line type of the telephone number. + example: Mobile + Line Provider: + type: string + description: The messaging service provider of the telephone number. + example: Verizon Wireless + Mobile Country Code: + type: string + description: The first half of the Home Network Identity (HNI). + example: '310' + Mobile Network Code: + type: string + description: The second half of the HNI. + example: '010' + tnLookupRequestError: + type: object + properties: + message: + type: string + description: A description of what validation error occurred. + example: example error message + responses: + createMessageResponse: + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/message' + listMessagesResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/messagesList' + getMediaResponse: + description: OK + content: + application/octet-stream: + schema: + type: string + description: Successful Operation + format: binary + listMediaResponse: + description: OK + headers: + Continuation-Token: + description: Continuation token used to retrieve subsequent media. + schema: + type: string + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/media' + messagingBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingNotAcceptableError: + description: Not Acceptable + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + createMessageBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/createMessageRequestError' + messagingUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingNotFoundError: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingInvalidMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingTooManyRequestsError: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + messagingInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/messagingRequestError' + createCallResponse: + description: Call Successfully Created + headers: + Location: + description: The URL for further interactions with this call + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/createCallResponse' + examples: + createCall Response: + $ref: '#/components/examples/createCallResponseExample' + getCallStateResponse: + description: Call found + content: + application/json: + schema: + $ref: '#/components/schemas/callState' + getStatisticsResponse: + description: Statistics Found + content: + application/json: + schema: + $ref: '#/components/schemas/accountStatistics' + listCallRecordingsResponse: + description: Recordings retrieved successfully + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/callRecordingMetadata' + getCallRecordingResponse: + description: Recording found + content: + application/json: + schema: + $ref: '#/components/schemas/callRecordingMetadata' + downloadRecordingMediaResponse: + description: Media found + content: + audio/vnd.wave: + schema: + type: string + format: binary + audio/mpeg: + schema: + type: string + format: binary + getCallTranscriptionResponse: + description: Transcription found + content: + application/json: + schema: + $ref: '#/components/schemas/transcriptionList' + listConferencesResponse: + description: Conferences retrieved successfully + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/conference' + examples: + listConferences Response: + $ref: '#/components/examples/listConferencesResponseExample' + getConferenceResponse: + description: Conferences retrieved successfully + content: + application/json: + schema: + $ref: '#/components/schemas/conference' + getConferenceMemberResponse: + description: Conference member found + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceMember' + listConferenceRecordingsResponse: + description: Conference recordings retrieved successfully + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/conferenceRecordingMetadata' + getConferenceRecordingResponse: + description: Conference recording found + content: + application/json: + schema: + $ref: '#/components/schemas/conferenceRecordingMetadata' + voiceBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + badRequestErrorExample: + $ref: '#/components/examples/voiceBadRequestErrorExample' + voiceUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + unauthorizedErrorExample: + $ref: '#/components/examples/voiceUnauthorizedErrorExample' + voiceForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + forbiddenErrorExample: + $ref: '#/components/examples/voiceForbiddenErrorExample' + voiceNotFoundError: + description: Not Found + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + notFoundErrorExample: + $ref: '#/components/examples/voiceNotFoundErrorExample' + voiceNotAllowedError: + description: Method Not Allowed + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + notAllowedErrorExample: + $ref: '#/components/examples/voiceNotAllowedErrorExample' + voiceConflictError: + description: Conflict + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + conflictErrorExample: + $ref: '#/components/examples/voiceConflictErrorExample' + voiceUnsupportedMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceUnsupportedMediaTypeErrorExample' + voiceTooManyRequestsError: + description: Too Many Requests + headers: + Retry-After: + description: When you should try your request again. + schema: + type: string + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + tooManyRequestsErrorExample: + $ref: '#/components/examples/voiceTooManyRequestsErrorExample' + voiceInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/voiceApiError' + examples: + internalServerErrorExample: + $ref: '#/components/examples/voiceInternalServerErrorExample' + voiceCodeResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/voiceCodeResponse' + messagingCodeResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/messagingCodeResponse' + verifyCodeResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/verifyCodeResponse' + mfaBadRequestError: + description: Bad Request + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + mfaUnauthorizedError: + description: Unauthorized + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/mfaUnauthorizedRequestError' + mfaForbiddenError: + description: Forbidden + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/mfaForbiddenRequestError' + mfaTooManyRequestsError: + description: Too Many Requests + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + mfaInternalServerError: + description: Internal Server Error + headers: {} + content: + application/json: + schema: + $ref: '#/components/schemas/mfaRequestError' + createLookupResponse: + description: Accepted + content: + application/json: + schema: + $ref: '#/components/schemas/createLookupResponse' + examples: + lookupResponseExample: + $ref: '#/components/examples/lookupInProgressExample' + getLookupResponse: + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/lookupStatus' + examples: + lookupInProgressExample: + $ref: '#/components/examples/lookupInProgressExample' + lookupFailedExample: + $ref: '#/components/examples/lookupFailedExample' + lookupSingleNumberCompleteExample: + $ref: '#/components/examples/lookupSingleNumberCompleteExample' + lookupMultipleNumbersCompleteExample: + $ref: '#/components/examples/lookupMultipleNumbersCompleteExample' + lookupMultipleNumbersPartialCompleteExample: + $ref: >- + #/components/examples/lookupMultipleNumbersPartialCompleteExample + lookupSingleNumberCompleteNoInfoExample: + $ref: '#/components/examples/lookupSingleNumberCompleteNoInfoExample' + tnLookupBadRequestError: + description: Bad Request + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + badRequest: + summary: Example Bad Request Error + value: + message: 'Some tns do not match e164 format: 1234' + tnLookupUnauthorizedError: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + unauthorized: + summary: Example Unauthorized Error + value: + message: Unauthorized + tnLookupForbiddenError: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + forbidden: + summary: Example Forbidden Error + value: + message: >- + Authorization header requires 'Credential' parameter. + Authorization header requires 'Signature' parameter. + Authorization header requires 'SignedHeaders' parameter. + Authorization header requires existence of either a + 'X-Amz-Date' or a 'Date' header. Authorization=Basic + Y2tvZloPTGhHgywYIzGlcGVlcGvvcGovYTIGIt==' + tnLookupMediaTypeError: + description: Unsupported Media Type + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + mediaType: + summary: Example Unsupported Media Type Error + value: + message: Content-Type must be application/json. + tnLookupTooManyRequestsError: + description: Too Many Requests + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + mediaType: + summary: Example Too Many Requests Error + value: + message: Too many requests. + tnLookupInternalServerError: + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/tnLookupRequestError' + examples: + mediaType: + summary: Example Internal Server Error Error + value: + message: Request has not been passed further. + parameters: + accountId: + in: path + name: accountId + required: true + schema: + type: string + description: Your Bandwidth Account ID. + example: '9900000' + mediaId: + in: path + name: mediaId + required: true + description: Media ID to retrieve. + example: 14762070468292kw2fuqty55yp2b2/0/bw.png + schema: + type: string + contentType: + in: header + name: Content-Type + style: simple + explode: false + description: The media type of the entity-body. + example: audio/wav + schema: + type: string + cacheControl: + in: header + name: Cache-Control + style: simple + explode: false + description: >- + General-header field is used to specify directives that MUST be obeyed + by all caching mechanisms along the request/response chain. + example: no-cache + schema: + type: string + continuationToken: + in: header + name: Continuation-Token + description: Continuation token used to retrieve subsequent media. + example: >- + 1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39 + schema: + type: string + messageId: + in: query + name: messageId + required: false + description: >- + The ID of the message to search for. Special characters need to be + encoded using URL encoding. Message IDs could come in different formats, + e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and + 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that + you must include at least one query parameter. + example: 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 + schema: + type: string + sourceTn: + in: query + name: sourceTn + required: false + description: >- + The phone number that sent the message. Accepted values are: a single + full phone number a comma separated list of full phone numbers (maximum + of 10) or a single partial phone number (minimum of 5 characters e.g. + '%2B1919'). + example: '%2B15554443333' + schema: + type: string + destinationTn: + in: query + name: destinationTn + required: false + description: >- + The phone number that received the message. Accepted values are: a + single full phone number a comma separated list of full phone numbers + (maximum of 10) or a single partial phone number (minimum of 5 + characters e.g. '%2B1919'). + example: '%2B15554443333' + schema: + type: string + messageStatus: + in: query + name: messageStatus + required: false + description: >- + The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED + DELIVERED ACCEPTED UNDELIVERED. + schema: + $ref: '#/components/schemas/messageStatusEnum' + messageDirection: + in: query + name: messageDirection + required: false + description: The direction of the message. One of INBOUND OUTBOUND. + schema: + $ref: '#/components/schemas/listMessageDirectionEnum' + carrierName: + in: query + name: carrierName + required: false + description: >- + The name of the carrier used for this message. Possible values include + but are not limited to Verizon and TMobile. Special characters need to + be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + example: Verizon + schema: + type: string + messageType: + in: query + name: messageType + required: false + description: The type of message. Either sms or mms. + schema: + $ref: '#/components/schemas/messageTypeEnum' + errorCode: + in: query + name: errorCode + required: false + description: The error code of the message. + example: 9902 + schema: + type: integer + fromDateTime: + in: query + name: fromDateTime + required: false + description: >- + The start of the date range to search in ISO 8601 format. Uses the + message receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + schema: + type: string + toDateTime: + in: query + name: toDateTime + required: false + description: >- + The end of the date range to search in ISO 8601 format. Uses the message + receive time. The date range to search in is currently 14 days. + example: 2022-09-14T18:20:16.000Z + schema: + type: string + campaignId: + in: query + name: campaignId + required: false + description: The campaign ID of the message. + example: CJEUMDK + schema: + type: string + sort: + in: query + name: sort + required: false + description: >- + The field and direction to sort by combined with a colon. Direction is + either asc or desc. + example: sourceTn:desc + schema: + type: string + pageToken: + in: query + name: pageToken + required: false + description: A base64 encoded value used for pagination of results. + example: gdEewhcJLQRB5 + schema: + type: string + limit: + in: query + name: limit + required: false + description: >- + The maximum records requested in search result. Default 100. The sum of + limit and after cannot be more than 10000. + schema: + type: integer + example: 50 + limitTotalCount: + in: query + name: limitTotalCount + required: false + description: >- + When set to true, the response's totalCount field will have a maximum + value of 10,000. When set to false, or excluded, this will give an + accurate totalCount of all messages that match the provided filters. If + you are experiencing latency, try using this parameter to limit your + results. + example: true + schema: + type: boolean + callId: + name: callId + in: path + required: true + schema: + type: string + description: Programmable Voice API Call ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + recordingId: + name: recordingId + in: path + required: true + schema: + type: string + description: Programmable Voice API Recording ID. + example: r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + conferenceId: + name: conferenceId + in: path + required: true + schema: + type: string + description: Programmable Voice API Conference ID. + example: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + memberId: + name: memberId + in: path + required: true + schema: + type: string + description: Programmable Voice API Conference Member ID. + example: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + to: + name: to + in: query + required: false + schema: + type: string + description: Filter results by the `to` field. + example: '%2b19195551234' + from: + name: from + in: query + required: false + schema: + type: string + description: Filter results by the `from` field. + example: '%2b19195554321' + name: + name: name + in: query + required: false + schema: + type: string + description: Filter results by the `name` field. + example: my-custom-name + minCreatedTime: + name: minCreatedTime + in: query + required: false + schema: + type: string + description: >- + Filter results to conferences which have a `createdTime` after or at + `minCreatedTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + maxCreatedTime: + name: maxCreatedTime + in: query + required: false + schema: + type: string + description: >- + Filter results to conferences which have a `createdTime` before or at + `maxCreatedTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + minStartTime: + name: minStartTime + in: query + required: false + schema: + type: string + description: >- + Filter results to recordings which have a `startTime` after or including + `minStartTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + maxStartTime: + name: maxStartTime + in: query + required: false + schema: + type: string + description: >- + Filter results to recordings which have a `startTime` before + `maxStartTime` (in ISO8601 format). + example: '2022-06-21T19:13:21Z' + pageSize: + name: pageSize + in: query + required: false + schema: + type: integer + format: int32 + minimum: 1 + maximum: 1000 + default: 1000 + description: Specifies the max number of conferences that will be returned. + example: 500 + pageToken1: + name: pageToken + in: query + required: false + schema: + type: string + description: >- + Not intended for explicit use. To use pagination, follow the links in + the `Link` header of the response, as indicated in the endpoint + description. + requestId: + name: requestId + in: path + required: true + schema: + type: string + description: The phone number lookup request ID from Bandwidth. + example: 004223a0-8b17-41b1-bf81-20732adf5590 + requestBodies: + createMessageRequest: + content: + application/json: + schema: + $ref: '#/components/schemas/messageRequest' + required: true + uploadMediaRequest: + content: + application/json: + schema: + type: string + format: binary + application/ogg: + schema: + type: string + format: binary + application/pdf: + schema: + type: string + format: binary + application/rtf: + schema: + type: string + format: binary + application/zip: + schema: + type: string + format: binary + application/x-tar: + schema: + type: string + format: binary + application/xml: + schema: + type: string + format: binary + application/gzip: + schema: + type: string + format: binary + application/x-bzip2: + schema: + type: string + format: binary + application/x-gzip: + schema: + type: string + format: binary + application/smil: + schema: + type: string + format: binary + application/javascript: + schema: + type: string + format: binary + audio/mp4: + schema: + type: string + format: binary + audio/mpeg: + schema: + type: string + format: binary + audio/ogg: + schema: + type: string + format: binary + audio/flac: + schema: + type: string + format: binary + audio/webm: + schema: + type: string + format: binary + audio/wav: + schema: + type: string + format: binary + audio/amr: + schema: + type: string + format: binary + audio/3gpp: + schema: + type: string + format: binary + image/bmp: + schema: + type: string + format: binary + image/gif: + schema: + type: string + format: binary + image/jpeg: + schema: + type: string + format: binary + image/pjpeg: + schema: + type: string + format: binary + image/png: + schema: + type: string + format: binary + image/svg+xml: + schema: + type: string + format: binary + image/tiff: + schema: + type: string + format: binary + image/webp: + schema: + type: string + format: binary + image/x-icon: + schema: + type: string + format: binary + text/css: + schema: + type: string + format: binary + text/csv: + schema: + type: string + format: binary + text/calendar: + schema: + type: string + format: binary + text/plain: + schema: + type: string + format: binary + text/javascript: + schema: + type: string + format: binary + text/vcard: + schema: + type: string + format: binary + text/vnd.wap.wml: + schema: + type: string + format: binary + text/xml: + schema: + type: string + format: binary + video/avi: + schema: + type: string + format: binary + video/mp4: + schema: + type: string + format: binary + video/mpeg: + schema: + type: string + format: binary + video/ogg: + schema: + type: string + format: binary + video/quicktime: + schema: + type: string + format: binary + video/webm: + schema: + type: string + format: binary + video/x-ms-wmv: + schema: + type: string + format: binary + required: true + createCallRequest: + description: JSON object containing information to create an outbound call + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/createCall' + updateCallRequest: + description: >- + JSON object containing information to redirect an existing call to a new + BXML document + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/updateCall' + updateCallBxmlRequest: + required: true + content: + application/xml: + schema: + type: string + description: A valid BXML document to replace the call's current BXML. + examples: + speakSentence: + summary: Speak Sentence + value: |- + + + This is a test sentence. + + redirectUrl: + summary: Redirect + value: |- + + + + + updateCallRecordingRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/updateCallRecording' + transcribeRecordingRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/transcribeRecording' + updateConferenceRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/updateConference' + updateConferenceBxmlRequest: + required: true + content: + application/xml: + schema: + type: string + description: A valid BXML document to replace the call's current BXML. + examples: + stopRecording: + summary: Stop Recording + value: |- + + + + + updateConferenceMemberRequest: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/updateConferenceMember' + codeRequest: + description: MFA code request body. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/codeRequest' + codeVerify: + description: MFA code verify request body. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/verifyCodeRequest' + createLookupRequest: + description: Phone number lookup request. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/lookupRequest' + examples: + singleNumberRequestExample: + $ref: '#/components/examples/singleNumberRequestExample' + multipleNumberRequestExample: + $ref: '#/components/examples/multipleNumberRequestExample' + securitySchemes: + Basic: + type: http + scheme: basic + description: |- + Basic authentication is a simple authentication scheme built into the + HTTP protocol. To use it, send your HTTP requests with an Authorization + header that contains the word Basic followed by a space and a + base64-encoded string `username:password`Example: `Authorization: Basic + ZGVtbZpwQDU1dzByZA==` + callbacks: + inboundCallback: + '{inboundCallbackUrl}': + post: + requestBody: + required: true + description: Inbound Message Callback Payload + content: + application/json: + schema: + $ref: '#/components/schemas/inboundMessageCallback' + responses: + '200': + description: OK + statusCallback: + '{statusCallbackUrl}': + post: + requestBody: + required: true + description: Status Callback Payload + content: + application/json: + schema: + type: object + oneOf: + - $ref: '#/components/schemas/messageSendingCallback' + - $ref: '#/components/schemas/messageDeliveredCallback' + - $ref: '#/components/schemas/messageFailedCallback' + responses: + '200': + description: OK + examples: + createCallResponseExample: + summary: Example of a createCall Response + value: + applicationId: 04e88489-df02-4e34-a0ee-27a91849555f + accountId: '9900000' + callId: c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + to: '+19195551234' + from: '+19195554312' + enqueuedTime: '2022-06-16T13:15:07.160Z' + callUrl: >- + https://voice.bandwidth.com/api/v2/accounts/9900000/calls/c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85 + callTimeout: 30 + callbackTimeout: 15 + tag: My custom tag value + answerMethod: POST + answerUrl: https://myServer.example/bandwidth/webhooks/answer + answerFallbackMethod: POST + disconnectMethod: POST + disconnectUrl: https://myServer.example/bandwidth/webhooks/disconnect + username: mySecretUsername + password: '*****' + fallbackUsername: mySecretUsername + fallbackPassword: '*****' + priority: 5 + listConferencesResponseExample: + summary: Example of a listConferences Response + value: + - id: conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9 + name: my-conference-name + createdTime: '2022-06-17T22:19:40.375Z' + completedTime: '2022-06-17T22:20:00.000Z' + conferenceEventUrl: https://myServer.example/bandwidth/webhooks/conferenceEvent + conferenceEventMethod: POST + tag: my custom tag + voiceBadRequestErrorExample: + summary: Example of a Bad Request (400) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnauthorizedErrorExample: + summary: Example of an Unauthorized (401) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceForbiddenErrorExample: + summary: Example of a Forbidden (403) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotFoundErrorExample: + summary: Example of a Not Found (404) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceNotAllowedErrorExample: + summary: Example of a Not Allowed (405) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceConflictErrorExample: + summary: Example of a Conflict (409) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceUnsupportedMediaTypeErrorExample: + summary: Example of an Unsupported Media Type (415) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceTooManyRequestsErrorExample: + summary: Example of a Too Many Requests (429) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + voiceInternalServerErrorExample: + summary: Example of an Internal Server (500) Error + value: + type: validation + description: 'Invalid answerUrl: only http and https are allowed.' + singleNumberRequestExample: + summary: Example Number Lookup Request for One Number + value: + tns: + - '+19195551234' + multipleNumberRequestExample: + summary: Example Number Lookup Request for Multiple Numbers + value: + tns: + - '+19195551234' + - '+19195554321' + lookupInProgressExample: + summary: Example Lookup In Progress Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: IN_PROGRESS + lookupFailedExample: + summary: Example Lookup Failed Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: FAILED + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteExample: + summary: Example Single Number Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + lookupMultipleNumbersCompleteExample: + summary: Example Multiple Numbers Lookup Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195554321' + Formatted: (919) 555-4321 + Country: US + Line Type: Mobile + Line Provider: T-Mobile USA + Mobile Country Code: '310' + Mobile Network Code: '160' + lookupMultipleNumbersPartialCompleteExample: + summary: Example Multiple Numbers Lookup Partial Complete Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: PARTIAL_COMPLETE + result: + - Response Code: 0 + Message: NOERROR + E.164 Format: '+19195551234' + Formatted: (919) 555-1234 + Country: US + Line Type: Mobile + Line Provider: Verizon Wireless + Mobile Country Code: '310' + Mobile Network Code: '010' + failedTelephoneNumbers: + - '+191955512345' + lookupSingleNumberCompleteNoInfoExample: + summary: Example Single Number Lookup Complete with No Information Response + value: + requestId: 004223a0-8b17-41b1-bf81-20732adf5590 + status: COMPLETE + result: + - Response Code: 3 + Message: NXDOMAIN + E.164 Format: '+19195550000' + Formatted: (919) 555-0000 + Country: US diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..f00a66d6 --- /dev/null +++ b/build.gradle @@ -0,0 +1,168 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' +apply plugin: 'com.diffplug.spotless' + +group = 'com.bandwidth.sdk' +version = '9.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } +} + +repositories { + mavenCentral() +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'bandwidth-sdk' + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + jakarta_annotation_version = "1.3.5" +} + +dependencies { + implementation 'io.swagger:swagger-annotations:1.6.8' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.10.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.8.5' + implementation 'javax.ws.rs:jsr311-api:1.1.1' + implementation 'javax.ws.rs:javax.ws.rs-api:2.1.1' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1' +} + +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + + removeUnusedImports() + importOrder() + } +} + +test { + // Enable JUnit 5 (Gradle 4.6+). + useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. + testLogging { + events "passed", "skipped", "failed" + } + +} diff --git a/build.sbt b/build.sbt new file mode 100644 index 00000000..b836076c --- /dev/null +++ b/build.sbt @@ -0,0 +1,28 @@ +lazy val root = (project in file(".")). + settings( + organization := "com.bandwidth.sdk", + name := "bandwidth-sdk", + version := "9.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.10.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.10.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "javax.ws.rs" % "jsr311-api" % "1.1.1", + "javax.ws.rs" % "javax.ws.rs-api" % "2.1.1", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", + "io.gsonfire" % "gson-fire" % "1.8.5" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.9.1" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" + ) + ) diff --git a/docs/AccountStatistics.md b/docs/AccountStatistics.md new file mode 100644 index 00000000..f3cf3bd7 --- /dev/null +++ b/docs/AccountStatistics.md @@ -0,0 +1,14 @@ + + +# AccountStatistics + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**currentCallQueueSize** | **Integer** | The number of calls currently enqueued. | [optional] | +|**maxCallQueueSize** | **Integer** | The maximum size of the queue before outgoing calls start being rejected. | [optional] | + + + diff --git a/docs/AnswerCallback.md b/docs/AnswerCallback.md new file mode 100644 index 00000000..41155d7a --- /dev/null +++ b/docs/AnswerCallback.md @@ -0,0 +1,27 @@ + + +# AnswerCallback + +The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**machineDetectionResult** | [**MachineDetectionResult**](MachineDetectionResult.md) | | [optional] | + + + diff --git a/docs/BridgeCompleteCallback.md b/docs/BridgeCompleteCallback.md new file mode 100644 index 00000000..d0267f32 --- /dev/null +++ b/docs/BridgeCompleteCallback.md @@ -0,0 +1,29 @@ + + +# BridgeCompleteCallback + +If the target call leaves the , then this callback is sent to the bridgeCompleteUrl, and the BXML returned in it is executed on the call. If this webhook is sent, the Bridge Target Complete webhook is NOT sent. This callback is also sent if any problem occurs that prevents the calls to be bridged. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | +|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | +|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | + + + diff --git a/docs/BridgeTargetCompleteCallback.md b/docs/BridgeTargetCompleteCallback.md new file mode 100644 index 00000000..ffd524af --- /dev/null +++ b/docs/BridgeTargetCompleteCallback.md @@ -0,0 +1,26 @@ + + +# BridgeTargetCompleteCallback + +If the originating call leaves the , then this callback is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed on the target call. If this webhook is sent, the Bridge Complete webhook is NOT sent. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/CallDirectionEnum.md b/docs/CallDirectionEnum.md new file mode 100644 index 00000000..d418026d --- /dev/null +++ b/docs/CallDirectionEnum.md @@ -0,0 +1,13 @@ + + +# CallDirectionEnum + +## Enum + + +* `INBOUND` (value: `"inbound"`) + +* `OUTBOUND` (value: `"outbound"`) + + + diff --git a/docs/CallRecordingMetadata.md b/docs/CallRecordingMetadata.md new file mode 100644 index 00000000..fe287c14 --- /dev/null +++ b/docs/CallRecordingMetadata.md @@ -0,0 +1,30 @@ + + +# CallRecordingMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**channels** | **Integer** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | +|**transcription** | [**TranscriptionMetadata**](TranscriptionMetadata.md) | | [optional] | + + + diff --git a/docs/CallState.md b/docs/CallState.md new file mode 100644 index 00000000..eadac2d0 --- /dev/null +++ b/docs/CallState.md @@ -0,0 +1,30 @@ + + +# CallState + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**applicationId** | **String** | The application id associated with the call. | [optional] | +|**accountId** | **String** | The account id associated with the call. | [optional] | +|**callId** | **String** | The programmable voice API call ID. | [optional] | +|**parentCallId** | **String** | The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer). | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI. | [optional] | +|**from** | **String** | The phone number that made the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**state** | **String** | The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**stirShaken** | **Map<String, String>** | For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Verification-Passed` or `TN-Verification-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). | [optional] | +|**identity** | **String** | The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | The time this call was placed in queue. | [optional] | +|**startTime** | **OffsetDateTime** | The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. | [optional] | +|**answerTime** | **OffsetDateTime** | Populated once the call has been answered, with the time in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | Populated once the call has ended, with the time in ISO 8601 format. | [optional] | +|**disconnectCause** | **String** | | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future. | [optional] | +|**errorMessage** | **String** | Populated only if the call ended with an error, with text explaining the reason. | [optional] | +|**errorId** | **String** | Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. | [optional] | +|**lastUpdate** | **OffsetDateTime** | The last time the call had a state update, in ISO 8601 format. | [optional] | + + + diff --git a/docs/CallStateEnum.md b/docs/CallStateEnum.md new file mode 100644 index 00000000..432f119a --- /dev/null +++ b/docs/CallStateEnum.md @@ -0,0 +1,13 @@ + + +# CallStateEnum + +## Enum + + +* `ACTIVE` (value: `"active"`) + +* `COMPLETED` (value: `"completed"`) + + + diff --git a/docs/CallbackMethodEnum.md b/docs/CallbackMethodEnum.md new file mode 100644 index 00000000..6005f3aa --- /dev/null +++ b/docs/CallbackMethodEnum.md @@ -0,0 +1,13 @@ + + +# CallbackMethodEnum + +## Enum + + +* `GET` (value: `"GET"`) + +* `POST` (value: `"POST"`) + + + diff --git a/docs/CallsApi.md b/docs/CallsApi.md new file mode 100644 index 00000000..1703920a --- /dev/null +++ b/docs/CallsApi.md @@ -0,0 +1,331 @@ +# CallsApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createCall**](CallsApi.md#createCall) | **POST** /accounts/{accountId}/calls | Create Call | +| [**getCallState**](CallsApi.md#getCallState) | **GET** /accounts/{accountId}/calls/{callId} | Get Call State Information | +| [**updateCall**](CallsApi.md#updateCall) | **POST** /accounts/{accountId}/calls/{callId} | Update Call | +| [**updateCallBxml**](CallsApi.md#updateCallBxml) | **PUT** /accounts/{accountId}/calls/{callId}/bxml | Update Call BXML | + + + +# **createCall** +> CreateCallResponse createCall(accountId, createCall) + +Create Call + +Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.CallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CreateCall createCall = new CreateCall(); // CreateCall | JSON object containing information to create an outbound call + try { + CreateCallResponse result = apiInstance.createCall(accountId, createCall); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#createCall"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **createCall** | [**CreateCall**](CreateCall.md)| JSON object containing information to create an outbound call | | + +### Return type + +[**CreateCallResponse**](CreateCallResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **201** | Call Successfully Created | * Location - The URL for further interactions with this call
| +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getCallState** +> CallState getCallState(accountId, callId) + +Get Call State Information + +Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.CallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + try { + CallState result = apiInstance.getCallState(accountId, callId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#getCallState"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | + +### Return type + +[**CallState**](CallState.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Call found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateCall** +> updateCall(accountId, callId, updateCall) + +Update Call + +Interrupts and redirects a call to a different URL that should return a BXML document. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.CallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + UpdateCall updateCall = new UpdateCall(); // UpdateCall | JSON object containing information to redirect an existing call to a new BXML document + try { + apiInstance.updateCall(accountId, callId, updateCall); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#updateCall"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **updateCall** | [**UpdateCall**](UpdateCall.md)| JSON object containing information to redirect an existing call to a new BXML document | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Call was successfully modified. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **409** | Conflict | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateCallBxml** +> updateCallBxml(accountId, callId, body) + +Update Call BXML + +Interrupts and replaces an active call's BXML document. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.CallsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + CallsApi apiInstance = new CallsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String body = + + This is a test sentence. +; // String | + try { + apiInstance.updateCallBxml(accountId, callId, body); + } catch (ApiException e) { + System.err.println("Exception when calling CallsApi#updateCallBxml"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **body** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/xml + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Call BXML was successfully replaced. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **409** | Conflict | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + diff --git a/docs/CodeRequest.md b/docs/CodeRequest.md new file mode 100644 index 00000000..5e7acdb8 --- /dev/null +++ b/docs/CodeRequest.md @@ -0,0 +1,18 @@ + + +# CodeRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | The phone number to send the mfa code to. | | +|**from** | **String** | The application phone number, the sender of the mfa code. | | +|**applicationId** | **String** | The application unique ID, obtained from Bandwidth. | | +|**scope** | **String** | An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". | [optional] | +|**message** | **String** | The message format of the mfa code. There are three values that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\" must be supplied. As the name would suggest, code will be replace with the actual mfa code. Name is replaced with the application name, configured during provisioning of mfa. The scope value is the same value sent during the call and partitioned by the server. | | +|**digits** | **Integer** | The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. | | + + + diff --git a/docs/Conference.md b/docs/Conference.md new file mode 100644 index 00000000..50adda68 --- /dev/null +++ b/docs/Conference.md @@ -0,0 +1,20 @@ + + +# Conference + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | The Bandwidth-generated conference ID. | [optional] | +|**name** | **String** | The name of the conference, as specified by your application. | [optional] | +|**createdTime** | **OffsetDateTime** | The time the conference was initiated, in ISO 8601 format. | [optional] | +|**completedTime** | **OffsetDateTime** | The time the conference was terminated, in ISO 8601 format. | [optional] | +|**conferenceEventUrl** | **URI** | The URL to send the conference-related events. | [optional] | +|**conferenceEventMethod** | **CallbackMethodEnum** | | [optional] | +|**tag** | **String** | The custom string attached to the conference that will be sent with callbacks. | [optional] | +|**activeMembers** | [**List<ConferenceMember>**](ConferenceMember.md) | A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). | [optional] | + + + diff --git a/docs/ConferenceCompletedCallback.md b/docs/ConferenceCompletedCallback.md new file mode 100644 index 00000000..6840355c --- /dev/null +++ b/docs/ConferenceCompletedCallback.md @@ -0,0 +1,18 @@ + + +# ConferenceCompletedCallback + +The Conference Completed event is fired when the last member leaves the conference. The response to this event may not contain BXML. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/ConferenceCreatedCallback.md b/docs/ConferenceCreatedCallback.md new file mode 100644 index 00000000..8f1196a0 --- /dev/null +++ b/docs/ConferenceCreatedCallback.md @@ -0,0 +1,18 @@ + + +# ConferenceCreatedCallback + +The Conference Created event is fired whenever a new conference that specified a callbackUrl is created. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/ConferenceMember.md b/docs/ConferenceMember.md new file mode 100644 index 00000000..061fc515 --- /dev/null +++ b/docs/ConferenceMember.md @@ -0,0 +1,18 @@ + + +# ConferenceMember + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callId** | **String** | The call id associated with the event. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**memberUrl** | **String** | A URL that may be used to retrieve information about or update the state of this conference member. This is the URL of this member's [Get Conference Member](/apis/voice/#operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice/#operation/updateConferenceMember) endpoint. | [optional] | +|**mute** | **Boolean** | Whether or not this member is currently muted. Members who are muted are still able to hear other participants. If used in a PUT request, updates this member's mute status. Has no effect if omitted. | [optional] | +|**hold** | **Boolean** | Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. If used in a PUT request, updates this member's hold status. Has no effect if omitted. | [optional] | +|**callIdsToCoach** | **List<String>** | If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. | [optional] | + + + diff --git a/docs/ConferenceMemberExitCallback.md b/docs/ConferenceMemberExitCallback.md new file mode 100644 index 00000000..1ae4cf2a --- /dev/null +++ b/docs/ConferenceMemberExitCallback.md @@ -0,0 +1,21 @@ + + +# ConferenceMemberExitCallback + +The Conference Member Exit event is fired whenever a caller exits a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/ConferenceMemberJoinCallback.md b/docs/ConferenceMemberJoinCallback.md new file mode 100644 index 00000000..73c91088 --- /dev/null +++ b/docs/ConferenceMemberJoinCallback.md @@ -0,0 +1,21 @@ + + +# ConferenceMemberJoinCallback + +The Conference Member Join event is fired whenever a caller joins a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/ConferenceRecordingAvailableCallback.md b/docs/ConferenceRecordingAvailableCallback.md new file mode 100644 index 00000000..41a8f825 --- /dev/null +++ b/docs/ConferenceRecordingAvailableCallback.md @@ -0,0 +1,27 @@ + + +# ConferenceRecordingAvailableCallback + +The Conference Recording Available event is sent after a conference recording has been processed. It indicates that the recording is available for download. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**channels** | **Integer** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | + + + diff --git a/docs/ConferenceRecordingMetadata.md b/docs/ConferenceRecordingMetadata.md new file mode 100644 index 00000000..ac343bd2 --- /dev/null +++ b/docs/ConferenceRecordingMetadata.md @@ -0,0 +1,23 @@ + + +# ConferenceRecordingMetadata + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**channels** | **Integer** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | + + + diff --git a/docs/ConferenceRedirectCallback.md b/docs/ConferenceRedirectCallback.md new file mode 100644 index 00000000..5dde9a89 --- /dev/null +++ b/docs/ConferenceRedirectCallback.md @@ -0,0 +1,18 @@ + + +# ConferenceRedirectCallback + +The Conference Redirect event is fired whenever an existing conference is modified via a POST request made to the /conferences/{conferenceId} endpoint. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**conferenceId** | **String** | The unique, Bandwidth-generated ID of the conference that was recorded | [optional] | +|**name** | **String** | The user-specified name of the conference that was recorded | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/ConferenceStateEnum.md b/docs/ConferenceStateEnum.md new file mode 100644 index 00000000..7160256f --- /dev/null +++ b/docs/ConferenceStateEnum.md @@ -0,0 +1,13 @@ + + +# ConferenceStateEnum + +## Enum + + +* `ACTIVE` (value: `"active"`) + +* `COMPLETED` (value: `"completed"`) + + + diff --git a/docs/ConferencesApi.md b/docs/ConferencesApi.md new file mode 100644 index 00000000..d4f0756b --- /dev/null +++ b/docs/ConferencesApi.md @@ -0,0 +1,741 @@ +# ConferencesApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**downloadConferenceRecording**](ConferencesApi.md#downloadConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media | Download Conference Recording | +| [**getConference**](ConferencesApi.md#getConference) | **GET** /accounts/{accountId}/conferences/{conferenceId} | Get Conference Information | +| [**getConferenceMember**](ConferencesApi.md#getConferenceMember) | **GET** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Get Conference Member | +| [**getConferenceRecording**](ConferencesApi.md#getConferenceRecording) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId} | Get Conference Recording Information | +| [**listConferenceRecordings**](ConferencesApi.md#listConferenceRecordings) | **GET** /accounts/{accountId}/conferences/{conferenceId}/recordings | Get Conference Recordings | +| [**listConferences**](ConferencesApi.md#listConferences) | **GET** /accounts/{accountId}/conferences | Get Conferences | +| [**updateConference**](ConferencesApi.md#updateConference) | **POST** /accounts/{accountId}/conferences/{conferenceId} | Update Conference | +| [**updateConferenceBxml**](ConferencesApi.md#updateConferenceBxml) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/bxml | Update Conference BXML | +| [**updateConferenceMember**](ConferencesApi.md#updateConferenceMember) | **PUT** /accounts/{accountId}/conferences/{conferenceId}/members/{memberId} | Update Conference Member | + + + +# **downloadConferenceRecording** +> File downloadConferenceRecording(accountId, conferenceId, recordingId) + +Download Conference Recording + +Downloads the specified recording file. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + File result = apiInstance.downloadConferenceRecording(accountId, conferenceId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#downloadConferenceRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +[**File**](File.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: audio/vnd.wave, audio/mpeg, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Media found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getConference** +> Conference getConference(accountId, conferenceId) + +Get Conference Information + +Returns information about the specified conference. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + try { + Conference result = apiInstance.getConference(accountId, conferenceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | + +### Return type + +[**Conference**](Conference.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Conferences retrieved successfully | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getConferenceMember** +> ConferenceMember getConferenceMember(accountId, conferenceId, memberId) + +Get Conference Member + +Returns information about the specified conference member. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Conference Member ID. + try { + ConferenceMember result = apiInstance.getConferenceMember(accountId, conferenceId, memberId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConferenceMember"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **memberId** | **String**| Programmable Voice API Conference Member ID. | | + +### Return type + +[**ConferenceMember**](ConferenceMember.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Conference member found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getConferenceRecording** +> ConferenceRecordingMetadata getConferenceRecording(accountId, conferenceId, recordingId) + +Get Conference Recording Information + +Returns metadata for the specified recording. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + ConferenceRecordingMetadata result = apiInstance.getConferenceRecording(accountId, conferenceId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#getConferenceRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +[**ConferenceRecordingMetadata**](ConferenceRecordingMetadata.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Conference recording found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **listConferenceRecordings** +> List<ConferenceRecordingMetadata> listConferenceRecordings(accountId, conferenceId) + +Get Conference Recordings + +Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + try { + List result = apiInstance.listConferenceRecordings(accountId, conferenceId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#listConferenceRecordings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | + +### Return type + +[**List<ConferenceRecordingMetadata>**](ConferenceRecordingMetadata.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Conference recordings retrieved successfully | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **listConferences** +> List<Conference> listConferences(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken) + +Get Conferences + +Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String name = "my-custom-name"; // String | Filter results by the `name` field. + String minCreatedTime = "2022-06-21T19:13:21Z"; // String | Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). + String maxCreatedTime = "2022-06-21T19:13:21Z"; // String | Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). + Integer pageSize = 1000; // Integer | Specifies the max number of conferences that will be returned. + String pageToken = "pageToken_example"; // String | Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. + try { + List result = apiInstance.listConferences(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#listConferences"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **name** | **String**| Filter results by the `name` field. | [optional] | +| **minCreatedTime** | **String**| Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). | [optional] | +| **maxCreatedTime** | **String**| Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). | [optional] | +| **pageSize** | **Integer**| Specifies the max number of conferences that will be returned. | [optional] [default to 1000] | +| **pageToken** | **String**| Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. | [optional] | + +### Return type + +[**List<Conference>**](Conference.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Conferences retrieved successfully | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateConference** +> updateConference(accountId, conferenceId, updateConference) + +Update Conference + +Update the conference state. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + UpdateConference updateConference = new UpdateConference(); // UpdateConference | + try { + apiInstance.updateConference(accountId, conferenceId, updateConference); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#updateConference"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **updateConference** | [**UpdateConference**](UpdateConference.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Conference was successfully modified. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateConferenceBxml** +> updateConferenceBxml(accountId, conferenceId, body) + +Update Conference BXML + +Update the conference BXML document. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String body = + + +; // String | + try { + apiInstance.updateConferenceBxml(accountId, conferenceId, body); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#updateConferenceBxml"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **body** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/xml + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Conference successfully modified. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateConferenceMember** +> updateConferenceMember(accountId, conferenceId, memberId, updateConferenceMember) + +Update Conference Member + +Updates settings for a particular conference member. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.ConferencesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + ConferencesApi apiInstance = new ConferencesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9"; // String | Programmable Voice API Conference ID. + String memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Conference Member ID. + UpdateConferenceMember updateConferenceMember = new UpdateConferenceMember(); // UpdateConferenceMember | + try { + apiInstance.updateConferenceMember(accountId, conferenceId, memberId, updateConferenceMember); + } catch (ApiException e) { + System.err.println("Exception when calling ConferencesApi#updateConferenceMember"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **conferenceId** | **String**| Programmable Voice API Conference ID. | | +| **memberId** | **String**| Programmable Voice API Conference Member ID. | | +| **updateConferenceMember** | [**UpdateConferenceMember**](UpdateConferenceMember.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Conference member was successfully modified. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + diff --git a/docs/CreateCall.md b/docs/CreateCall.md new file mode 100644 index 00000000..a838dc3b --- /dev/null +++ b/docs/CreateCall.md @@ -0,0 +1,32 @@ + + +# CreateCall + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). | | +|**from** | **String** | A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`, or be one of the following strings: `Restricted`, `Anonymous`, `Private`, or `Unavailable`). | | +|**displayName** | **String** | The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. | [optional] | +|**uui** | **String** | A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt' and 'base64' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. | [optional] | +|**applicationId** | **String** | The id of the application associated with the `from` number. | | +|**answerUrl** | **URI** | The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`. | | +|**answerMethod** | **CallbackMethodEnum** | | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**answerFallbackUrl** | **URI** | A fallback url which, if provided, will be used to retry the `answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`. | [optional] | +|**answerFallbackMethod** | **CallbackMethodEnum** | | [optional] | +|**fallbackUsername** | **String** | Basic auth username. | [optional] | +|**fallbackPassword** | **String** | Basic auth password. | [optional] | +|**disconnectUrl** | **URI** | The URL to send the <a href='/docs/voice/webhooks/disconnect'>Disconnect</a> event to when the call ends. This event does not expect a BXML response. | [optional] | +|**disconnectMethod** | **CallbackMethodEnum** | | [optional] | +|**callTimeout** | **Double** | The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300. | [optional] | +|**callbackTimeout** | **Double** | This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25. | [optional] | +|**machineDetection** | [**MachineDetectionConfiguration**](MachineDetectionConfiguration.md) | | [optional] | +|**priority** | **Integer** | The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call. | [optional] | +|**tag** | **String** | A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 256 characters. | [optional] | + + + diff --git a/docs/CreateCallResponse.md b/docs/CreateCallResponse.md new file mode 100644 index 00000000..0a317eee --- /dev/null +++ b/docs/CreateCallResponse.md @@ -0,0 +1,33 @@ + + +# CreateCallResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**applicationId** | **String** | The id of the application associated with the `from` number. | | +|**accountId** | **String** | The bandwidth account ID associated with the call. | | +|**callId** | **String** | Programmable Voice API Call ID. | | +|**to** | **String** | Recipient of the outgoing call. | | +|**from** | **String** | Phone number that created the outbound call. | | +|**enqueuedTime** | **OffsetDateTime** | The time at which the call was accepted into the queue. | [optional] | +|**callUrl** | **URI** | The URL to update this call's state. | | +|**callTimeout** | **Double** | The timeout (in seconds) for the callee to answer the call after it starts ringing. | [optional] | +|**callbackTimeout** | **Double** | This is the timeout (in seconds) to use when delivering webhooks for the call. | [optional] | +|**tag** | **String** | Custom tag value. | [optional] | +|**answerMethod** | **CallbackMethodEnum** | | | +|**answerUrl** | **URI** | URL to deliver the `answer` event webhook. | | +|**answerFallbackMethod** | **CallbackMethodEnum** | | [optional] | +|**answerFallbackUrl** | **URI** | Fallback URL to deliver the `answer` event webhook. | [optional] | +|**disconnectMethod** | **CallbackMethodEnum** | | | +|**disconnectUrl** | **URI** | URL to deliver the `disconnect` event webhook. | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**fallbackUsername** | **String** | Basic auth username. | [optional] | +|**fallbackPassword** | **String** | Basic auth password. | [optional] | +|**priority** | **Integer** | The priority of this call over other calls from your account. | [optional] | + + + diff --git a/docs/CreateLookupResponse.md b/docs/CreateLookupResponse.md new file mode 100644 index 00000000..98465c52 --- /dev/null +++ b/docs/CreateLookupResponse.md @@ -0,0 +1,15 @@ + + +# CreateLookupResponse + +The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**requestId** | **String** | The phone number lookup request ID from Bandwidth. | [optional] | +|**status** | **LookupStatusEnum** | | [optional] | + + + diff --git a/docs/CreateMessageRequestError.md b/docs/CreateMessageRequestError.md new file mode 100644 index 00000000..b10de372 --- /dev/null +++ b/docs/CreateMessageRequestError.md @@ -0,0 +1,15 @@ + + +# CreateMessageRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | | +|**description** | **String** | | | +|**fieldErrors** | [**List<FieldError>**](FieldError.md) | | [optional] | + + + diff --git a/docs/DeferredResult.md b/docs/DeferredResult.md new file mode 100644 index 00000000..89bd997f --- /dev/null +++ b/docs/DeferredResult.md @@ -0,0 +1,14 @@ + + +# DeferredResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**result** | **Object** | | [optional] | +|**setOrExpired** | **Boolean** | | [optional] | + + + diff --git a/docs/DeviceApiVersionEnum.md b/docs/DeviceApiVersionEnum.md new file mode 100644 index 00000000..4b282835 --- /dev/null +++ b/docs/DeviceApiVersionEnum.md @@ -0,0 +1,11 @@ + + +# DeviceApiVersionEnum + +## Enum + + +* `V3` (value: `"V3"`) + + + diff --git a/docs/DisconenctCallback.md b/docs/DisconenctCallback.md new file mode 100644 index 00000000..f7a47d6f --- /dev/null +++ b/docs/DisconenctCallback.md @@ -0,0 +1,30 @@ + + +# DisconenctCallback + +The Disconnect event is fired when a call ends, for any reason. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **String** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | +|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | +|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/DisconnectCallback.md b/docs/DisconnectCallback.md new file mode 100644 index 00000000..60c6b869 --- /dev/null +++ b/docs/DisconnectCallback.md @@ -0,0 +1,30 @@ + + +# DisconnectCallback + +The Disconnect event is fired when a call ends, for any reason. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | +|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | +|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/Diversion.md b/docs/Diversion.md new file mode 100644 index 00000000..dbdf3870 --- /dev/null +++ b/docs/Diversion.md @@ -0,0 +1,19 @@ + + +# Diversion + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**reason** | **String** | The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. | [optional] | +|**privacy** | **String** | off or full | [optional] | +|**screen** | **String** | No if the number was provided by the user, yes if the number was provided by the network | [optional] | +|**counter** | **String** | The number of diversions that have occurred | [optional] | +|**limit** | **String** | The maximum number of diversions allowed for this session | [optional] | +|**unknown** | **String** | The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys. | [optional] | +|**origTo** | **String** | Always present. Indicates the last telephone number that the call was diverted from. | [optional] | + + + diff --git a/docs/DtmfCallback.md b/docs/DtmfCallback.md new file mode 100644 index 00000000..3fe2b647 --- /dev/null +++ b/docs/DtmfCallback.md @@ -0,0 +1,30 @@ + + +# DtmfCallback + +The DTMF event is sent for every digit detected after a verb is executed. You may not respond to this event with BXML. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**digit** | **String** | The digit collected in the call. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/FieldError.md b/docs/FieldError.md new file mode 100644 index 00000000..c809a32c --- /dev/null +++ b/docs/FieldError.md @@ -0,0 +1,14 @@ + + +# FieldError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**fieldName** | **String** | The name of the field that contains the error | [optional] | +|**description** | **String** | The error associated with the field | [optional] | + + + diff --git a/docs/FileFormatEnum.md b/docs/FileFormatEnum.md new file mode 100644 index 00000000..6638c447 --- /dev/null +++ b/docs/FileFormatEnum.md @@ -0,0 +1,13 @@ + + +# FileFormatEnum + +## Enum + + +* `MP3` (value: `"mp3"`) + +* `WAV` (value: `"wav"`) + + + diff --git a/docs/GatherCallback.md b/docs/GatherCallback.md new file mode 100644 index 00000000..b8514738 --- /dev/null +++ b/docs/GatherCallback.md @@ -0,0 +1,31 @@ + + +# GatherCallback + +The gather event is sent after a verb is executed. Its purpose is to report the gathered digits to the calling application. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**digits** | **String** | (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**terminatingDigit** | **String** | (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | + + + diff --git a/docs/InboundMessageCallback.md b/docs/InboundMessageCallback.md new file mode 100644 index 00000000..e0b84c8e --- /dev/null +++ b/docs/InboundMessageCallback.md @@ -0,0 +1,18 @@ + + +# InboundMessageCallback + +Inbound Message Callback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **String** | | | +|**to** | **String** | | | +|**description** | **String** | | | +|**message** | [**InboundMessageCallbackMessage**](InboundMessageCallbackMessage.md) | | | + + + diff --git a/docs/InboundMessageCallbackMessage.md b/docs/InboundMessageCallbackMessage.md new file mode 100644 index 00000000..2f45fd05 --- /dev/null +++ b/docs/InboundMessageCallbackMessage.md @@ -0,0 +1,25 @@ + + +# InboundMessageCallbackMessage + +Inbound Message Callback Message Schema + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | | +|**owner** | **String** | | | +|**applicationId** | **String** | | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | | | +|**from** | **String** | | | +|**text** | **String** | | | +|**tag** | **String** | | [optional] | +|**media** | **List<URI>** | | [optional] | +|**priority** | **PriorityEnum** | | [optional] | + + + diff --git a/docs/InitiateCallback.md b/docs/InitiateCallback.md new file mode 100644 index 00000000..fa56508d --- /dev/null +++ b/docs/InitiateCallback.md @@ -0,0 +1,25 @@ + + +# InitiateCallback + +The Initiate event is fired when an inbound call is received for a Telephone Number on your Account. It is sent to the URL specified in the application associated with the location (sip-peer) that the called telephone number belongs to. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**diversion** | [**Diversion**](Diversion.md) | | [optional] | +|**stirShaken** | [**StirShaken**](StirShaken.md) | | [optional] | + + + diff --git a/docs/ListMessageDirectionEnum.md b/docs/ListMessageDirectionEnum.md new file mode 100644 index 00000000..a2a1812e --- /dev/null +++ b/docs/ListMessageDirectionEnum.md @@ -0,0 +1,13 @@ + + +# ListMessageDirectionEnum + +## Enum + + +* `INBOUND` (value: `"INBOUND"`) + +* `OUTBOUND` (value: `"OUTBOUND"`) + + + diff --git a/docs/ListMessageItem.md b/docs/ListMessageItem.md new file mode 100644 index 00000000..0829baf8 --- /dev/null +++ b/docs/ListMessageItem.md @@ -0,0 +1,29 @@ + + +# ListMessageItem + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**messageId** | **String** | The message id | [optional] | +|**accountId** | **String** | The account id associated with this message. | [optional] | +|**sourceTn** | **String** | The source phone number of the message. | [optional] | +|**destinationTn** | **String** | The recipient phone number of the message. | [optional] | +|**messageStatus** | **MessageStatusEnum** | | [optional] | +|**messageDirection** | **ListMessageDirectionEnum** | | [optional] | +|**messageType** | **MessageTypeEnum** | | [optional] | +|**segmentCount** | **Integer** | The number of segments the message was sent as. | [optional] | +|**errorCode** | **Integer** | The numeric error code of the message. | [optional] | +|**receiveTime** | **OffsetDateTime** | The ISO 8601 datetime of the message. | [optional] | +|**carrierName** | **String** | The name of the carrier. Not currently supported for MMS coming soon. | [optional] | +|**messageSize** | **Integer** | The size of the message including message content and headers. | [optional] | +|**messageLength** | **Integer** | The length of the message content. | [optional] | +|**attachmentCount** | **Integer** | The number of attachments the message has. | [optional] | +|**recipientCount** | **Integer** | The number of recipients the message has. | [optional] | +|**campaignClass** | **String** | The campaign class of the message if it has one. | [optional] | +|**campaignId** | **String** | The campaign ID of the message if it has one. | [optional] | + + + diff --git a/docs/LookupRequest.md b/docs/LookupRequest.md new file mode 100644 index 00000000..30637433 --- /dev/null +++ b/docs/LookupRequest.md @@ -0,0 +1,14 @@ + + +# LookupRequest + +Create phone number lookup request. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**tns** | **List<String>** | | | + + + diff --git a/docs/LookupResult.md b/docs/LookupResult.md new file mode 100644 index 00000000..e2f23396 --- /dev/null +++ b/docs/LookupResult.md @@ -0,0 +1,22 @@ + + +# LookupResult + +Carrier information results for the specified telephone number. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**responseCode** | **Integer** | Our vendor's response code. | [optional] | +|**message** | **String** | Message associated with the response code. | [optional] | +|**e164Format** | **String** | The telephone number in E.164 format. | [optional] | +|**formatted** | **String** | The formatted version of the telephone number. | [optional] | +|**country** | **String** | The country of the telephone number. | [optional] | +|**lineType** | **String** | The line type of the telephone number. | [optional] | +|**lineProvider** | **String** | The messaging service provider of the telephone number. | [optional] | +|**mobileCountryCode** | **String** | The first half of the Home Network Identity (HNI). | [optional] | +|**mobileNetworkCode** | **String** | The second half of the HNI. | [optional] | + + + diff --git a/docs/LookupStatus.md b/docs/LookupStatus.md new file mode 100644 index 00000000..bfb3e8be --- /dev/null +++ b/docs/LookupStatus.md @@ -0,0 +1,17 @@ + + +# LookupStatus + +If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**requestId** | **String** | The requestId. | [optional] | +|**status** | **LookupStatusEnum** | | [optional] | +|**result** | [**List<LookupResult>**](LookupResult.md) | The carrier information results for the specified telephone number. | [optional] | +|**failedTelephoneNumbers** | **List<String>** | The telephone numbers whose lookup failed. | [optional] | + + + diff --git a/docs/LookupStatusEnum.md b/docs/LookupStatusEnum.md new file mode 100644 index 00000000..e93f9d3f --- /dev/null +++ b/docs/LookupStatusEnum.md @@ -0,0 +1,17 @@ + + +# LookupStatusEnum + +## Enum + + +* `IN_PROGRESS` (value: `"IN_PROGRESS"`) + +* `COMPLETE` (value: `"COMPLETE"`) + +* `PARTIAL_COMPLETE` (value: `"PARTIAL_COMPLETE"`) + +* `FAILED` (value: `"FAILED"`) + + + diff --git a/docs/MachineDetectionCompleteCallback.md b/docs/MachineDetectionCompleteCallback.md new file mode 100644 index 00000000..64c54e62 --- /dev/null +++ b/docs/MachineDetectionCompleteCallback.md @@ -0,0 +1,27 @@ + + +# MachineDetectionCompleteCallback + +This event is sent to the url informed when requesting a machine detection operation. It contains the machine detection operation result, which can be: human, answering-machine, silence, timeout, error. This event is not sent when sync answering machine detection mode is chosen. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**machineDetectionResult** | [**MachineDetectionResult**](MachineDetectionResult.md) | | [optional] | + + + diff --git a/docs/MachineDetectionConfiguration.md b/docs/MachineDetectionConfiguration.md new file mode 100644 index 00000000..a910e092 --- /dev/null +++ b/docs/MachineDetectionConfiguration.md @@ -0,0 +1,28 @@ + + +# MachineDetectionConfiguration + +The machine detection request used to perform machine detection on the call. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mode** | **MachineDetectionModeEnum** | | [optional] | +|**detectionTimeout** | **Double** | The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent. | [optional] | +|**silenceTimeout** | **Double** | If no speech is detected in this period, a callback with a 'silence' result is sent. | [optional] | +|**speechThreshold** | **Double** | When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. | [optional] | +|**speechEndThreshold** | **Double** | Amount of silence (in seconds) before assuming the callee has finished speaking. | [optional] | +|**machineSpeechEndThreshold** | **Double** | When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. | [optional] | +|**delayResult** | **Boolean** | If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. | [optional] | +|**callbackUrl** | **URI** | The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. | [optional] | +|**callbackMethod** | **CallbackMethodEnum** | | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**fallbackUrl** | **URI** | A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond | [optional] | +|**fallbackMethod** | **CallbackMethodEnum** | | [optional] | +|**fallbackUsername** | **String** | Basic auth username. | [optional] | +|**fallbackPassword** | **String** | Basic auth password. | [optional] | + + + diff --git a/docs/MachineDetectionModeEnum.md b/docs/MachineDetectionModeEnum.md new file mode 100644 index 00000000..34ec8f48 --- /dev/null +++ b/docs/MachineDetectionModeEnum.md @@ -0,0 +1,13 @@ + + +# MachineDetectionModeEnum + +## Enum + + +* `SYNC` (value: `"sync"`) + +* `ASYNC` (value: `"async"`) + + + diff --git a/docs/MachineDetectionResult.md b/docs/MachineDetectionResult.md new file mode 100644 index 00000000..2073a8e7 --- /dev/null +++ b/docs/MachineDetectionResult.md @@ -0,0 +1,15 @@ + + +# MachineDetectionResult + +(optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**value** | **String** | Possible values are answering-machine, human, silence, timeout, or error. | [optional] | +|**duration** | **String** | The amount of time it took to determine the result. | [optional] | + + + diff --git a/docs/Media.md b/docs/Media.md new file mode 100644 index 00000000..eba87762 --- /dev/null +++ b/docs/Media.md @@ -0,0 +1,15 @@ + + +# Media + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**content** | **String** | | [optional] | +|**contentLength** | **Integer** | | [optional] | +|**mediaName** | **String** | | [optional] | + + + diff --git a/docs/MediaApi.md b/docs/MediaApi.md new file mode 100644 index 00000000..b24e28b0 --- /dev/null +++ b/docs/MediaApi.md @@ -0,0 +1,328 @@ +# MediaApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteMedia**](MediaApi.md#deleteMedia) | **DELETE** /users/{accountId}/media/{mediaId} | Delete Media | +| [**getMedia**](MediaApi.md#getMedia) | **GET** /users/{accountId}/media/{mediaId} | Get Media | +| [**listMedia**](MediaApi.md#listMedia) | **GET** /users/{accountId}/media | List Media | +| [**uploadMedia**](MediaApi.md#uploadMedia) | **PUT** /users/{accountId}/media/{mediaId} | Upload Media | + + + +# **deleteMedia** +> deleteMedia(accountId, mediaId) + +Delete Media + +Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MediaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. + try { + apiInstance.deleteMedia(accountId, mediaId); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#deleteMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **mediaId** | **String**| Media ID to retrieve. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **406** | Not Acceptable | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + + +# **getMedia** +> File getMedia(accountId, mediaId) + +Get Media + +Downloads a media file you previously uploaded. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MediaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. + try { + File result = apiInstance.getMedia(accountId, mediaId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#getMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **mediaId** | **String**| Media ID to retrieve. | | + +### Return type + +[**File**](File.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/octet-stream, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **406** | Not Acceptable | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + + +# **listMedia** +> List<Media> listMedia(accountId, continuationToken) + +List Media + +Gets a list of your media files. No query parameters are supported. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MediaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String continuationToken = "1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39"; // String | Continuation token used to retrieve subsequent media. + try { + List result = apiInstance.listMedia(accountId, continuationToken); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#listMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **continuationToken** | **String**| Continuation token used to retrieve subsequent media. | [optional] | + +### Return type + +[**List<Media>**](Media.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | * Continuation-Token - Continuation token used to retrieve subsequent media.
| +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **406** | Not Acceptable | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + + +# **uploadMedia** +> uploadMedia(accountId, mediaId, body, contentType, cacheControl) + +Upload Media + +Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MediaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MediaApi apiInstance = new MediaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png"; // String | Media ID to retrieve. + File body = new File("/path/to/file"); // File | + String contentType = "audio/wav"; // String | The media type of the entity-body. + String cacheControl = "no-cache"; // String | General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. + try { + apiInstance.uploadMedia(accountId, mediaId, body, contentType, cacheControl); + } catch (ApiException e) { + System.err.println("Exception when calling MediaApi#uploadMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **mediaId** | **String**| Media ID to retrieve. | | +| **body** | **File**| | | +| **contentType** | **String**| The media type of the entity-body. | [optional] | +| **cacheControl** | **String**| General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. | [optional] | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json, application/ogg, application/pdf, application/rtf, application/zip, application/x-tar, application/xml, application/gzip, application/x-bzip2, application/x-gzip, application/smil, application/javascript, audio/mp4, audio/mpeg, audio/ogg, audio/flac, audio/webm, audio/wav, audio/amr, audio/3gpp, image/bmp, image/gif, image/jpeg, image/pjpeg, image/png, image/svg+xml, image/tiff, image/webp, image/x-icon, text/css, text/csv, text/calendar, text/plain, text/javascript, text/vcard, text/vnd.wap.wml, text/xml, video/avi, video/mp4, video/mpeg, video/ogg, video/quicktime, video/webm, video/x-ms-wmv + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | No Content | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **406** | Not Acceptable | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + diff --git a/docs/Message.md b/docs/Message.md new file mode 100644 index 00000000..ef12c3ba --- /dev/null +++ b/docs/Message.md @@ -0,0 +1,25 @@ + + +# Message + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | The id of the message. | [optional] | +|**owner** | **String** | The Bandwidth phone number associated with the message. | [optional] | +|**applicationId** | **String** | The application ID associated with the message. | [optional] | +|**time** | **OffsetDateTime** | The datetime stamp of the message in ISO 8601 | [optional] | +|**segmentCount** | **Integer** | The number of segments the original message from the user is broken into before sending over to carrier networks. | [optional] | +|**direction** | **MessageDirectionEnum** | | [optional] | +|**to** | **Set<String>** | The phone number recipients of the message. | [optional] | +|**from** | **String** | The phone number the message was sent from. | [optional] | +|**media** | **Set<String>** | The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. | [optional] | +|**text** | **String** | The contents of the message. | [optional] | +|**tag** | **String** | The custom string set by the user. | [optional] | +|**priority** | **PriorityEnum** | | [optional] | +|**expiration** | **OffsetDateTime** | The expiration date-time set by the user. | [optional] | + + + diff --git a/docs/MessageDeliveredCallback.md b/docs/MessageDeliveredCallback.md new file mode 100644 index 00000000..0983c27c --- /dev/null +++ b/docs/MessageDeliveredCallback.md @@ -0,0 +1,18 @@ + + +# MessageDeliveredCallback + +Message Delivered Callback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **String** | | | +|**to** | **String** | | | +|**description** | **String** | | | +|**message** | [**MessageDeliveredCallbackMessage**](MessageDeliveredCallbackMessage.md) | | | + + + diff --git a/docs/MessageDeliveredCallbackMessage.md b/docs/MessageDeliveredCallbackMessage.md new file mode 100644 index 00000000..4a774285 --- /dev/null +++ b/docs/MessageDeliveredCallbackMessage.md @@ -0,0 +1,25 @@ + + +# MessageDeliveredCallbackMessage + +Message Delivered Callback Message Schema + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | | +|**owner** | **String** | | | +|**applicationId** | **String** | | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | | | +|**from** | **String** | | | +|**text** | **String** | | | +|**tag** | **String** | | | +|**media** | **List<URI>** | | [optional] | +|**priority** | **PriorityEnum** | | [optional] | + + + diff --git a/docs/MessageDirectionEnum.md b/docs/MessageDirectionEnum.md new file mode 100644 index 00000000..2867521a --- /dev/null +++ b/docs/MessageDirectionEnum.md @@ -0,0 +1,13 @@ + + +# MessageDirectionEnum + +## Enum + + +* `IN` (value: `"in"`) + +* `OUT` (value: `"out"`) + + + diff --git a/docs/MessageFailedCallback.md b/docs/MessageFailedCallback.md new file mode 100644 index 00000000..89e9d1c8 --- /dev/null +++ b/docs/MessageFailedCallback.md @@ -0,0 +1,19 @@ + + +# MessageFailedCallback + +Message Failed Callback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **String** | | | +|**to** | **String** | | | +|**description** | **String** | | | +|**message** | [**MessageFailedCallbackMessage**](MessageFailedCallbackMessage.md) | | | +|**errorCode** | **Integer** | | | + + + diff --git a/docs/MessageFailedCallbackMessage.md b/docs/MessageFailedCallbackMessage.md new file mode 100644 index 00000000..3ddfbc1b --- /dev/null +++ b/docs/MessageFailedCallbackMessage.md @@ -0,0 +1,25 @@ + + +# MessageFailedCallbackMessage + +Message Failed Callback Message Schema + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | | +|**owner** | **String** | | | +|**applicationId** | **String** | | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | | | +|**from** | **String** | | | +|**text** | **String** | | | +|**tag** | **String** | | | +|**media** | **List<URI>** | | [optional] | +|**priority** | **PriorityEnum** | | | + + + diff --git a/docs/MessageRequest.md b/docs/MessageRequest.md new file mode 100644 index 00000000..b2af422b --- /dev/null +++ b/docs/MessageRequest.md @@ -0,0 +1,20 @@ + + +# MessageRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**applicationId** | **String** | The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. | | +|**to** | **Set<String>** | The phone number(s) the message should be sent to in E164 format. | | +|**from** | **String** | One of your telephone numbers the message should come from in E164 format. | | +|**text** | **String** | The contents of the text message. Must be 2048 characters or less. | [optional] | +|**media** | **List<URI>** | A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. | [optional] | +|**tag** | **String** | A custom string that will be included in callback events of the message. Max 1024 characters. | [optional] | +|**priority** | **PriorityEnum** | | [optional] | +|**expiration** | **OffsetDateTime** | A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. | [optional] | + + + diff --git a/docs/MessageSendingCallback.md b/docs/MessageSendingCallback.md new file mode 100644 index 00000000..60bef107 --- /dev/null +++ b/docs/MessageSendingCallback.md @@ -0,0 +1,18 @@ + + +# MessageSendingCallback + +Message Sending Callback + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**time** | **OffsetDateTime** | | | +|**type** | **String** | | | +|**to** | **String** | | | +|**description** | **String** | | | +|**message** | [**MessageSendingCallbackMessage**](MessageSendingCallbackMessage.md) | | | + + + diff --git a/docs/MessageSendingCallbackMessage.md b/docs/MessageSendingCallbackMessage.md new file mode 100644 index 00000000..7611cfb0 --- /dev/null +++ b/docs/MessageSendingCallbackMessage.md @@ -0,0 +1,25 @@ + + +# MessageSendingCallbackMessage + +Message Sending Callback Message Schema + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | | | +|**owner** | **String** | | | +|**applicationId** | **String** | | | +|**time** | **OffsetDateTime** | | | +|**segmentCount** | **Integer** | | | +|**direction** | **MessageDirectionEnum** | | | +|**to** | **Set<String>** | | | +|**from** | **String** | | | +|**text** | **String** | | | +|**tag** | **String** | | [optional] | +|**media** | **List<URI>** | | | +|**priority** | **PriorityEnum** | | | + + + diff --git a/docs/MessageStatusEnum.md b/docs/MessageStatusEnum.md new file mode 100644 index 00000000..3c90bb84 --- /dev/null +++ b/docs/MessageStatusEnum.md @@ -0,0 +1,25 @@ + + +# MessageStatusEnum + +## Enum + + +* `RECEIVED` (value: `"RECEIVED"`) + +* `QUEUED` (value: `"QUEUED"`) + +* `SENDING` (value: `"SENDING"`) + +* `SENT` (value: `"SENT"`) + +* `FAILED` (value: `"FAILED"`) + +* `DELIVERED` (value: `"DELIVERED"`) + +* `ACCEPTED` (value: `"ACCEPTED"`) + +* `UNDELIVERED` (value: `"UNDELIVERED"`) + + + diff --git a/docs/MessageTypeEnum.md b/docs/MessageTypeEnum.md new file mode 100644 index 00000000..50a0a4ca --- /dev/null +++ b/docs/MessageTypeEnum.md @@ -0,0 +1,13 @@ + + +# MessageTypeEnum + +## Enum + + +* `SMS` (value: `"sms"`) + +* `MMS` (value: `"mms"`) + + + diff --git a/docs/MessagesApi.md b/docs/MessagesApi.md new file mode 100644 index 00000000..641562b7 --- /dev/null +++ b/docs/MessagesApi.md @@ -0,0 +1,193 @@ +# MessagesApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createMessage**](MessagesApi.md#createMessage) | **POST** /users/{accountId}/messages | Create Message | +| [**listMessages**](MessagesApi.md#listMessages) | **GET** /users/{accountId}/messages | List Messages | + + + +# **createMessage** +> Message createMessage(accountId, messageRequest) + +Create Message + +Endpoint for sending text messages and picture messages using V2 messaging. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + MessageRequest messageRequest = new MessageRequest(); // MessageRequest | + try { + Message result = apiInstance.createMessage(accountId, messageRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#createMessage"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **messageRequest** | [**MessageRequest**](MessageRequest.md)| | | + +### Return type + +[**Message**](Message.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **406** | Not Acceptable | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + + +# **listMessages** +> MessagesList listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount) + +List Messages + +Returns a list of messages based on query parameters. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MessagesApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MessagesApi apiInstance = new MessagesApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6"; // String | The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. + String sourceTn = "%2B15554443333"; // String | The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + String destinationTn = "%2B15554443333"; // String | The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). + MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED"); // MessageStatusEnum | The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + ListMessageDirectionEnum messageDirection = ListMessageDirectionEnum.fromValue("INBOUND"); // ListMessageDirectionEnum | The direction of the message. One of INBOUND OUTBOUND. + String carrierName = "Verizon"; // String | The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). + MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms"); // MessageTypeEnum | The type of message. Either sms or mms. + Integer errorCode = 9902; // Integer | The error code of the message. + String fromDateTime = "2022-09-14T18:20:16.000Z"; // String | The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String toDateTime = "2022-09-14T18:20:16.000Z"; // String | The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. + String campaignId = "CJEUMDK"; // String | The campaign ID of the message. + String sort = "sourceTn:desc"; // String | The field and direction to sort by combined with a colon. Direction is either asc or desc. + String pageToken = "gdEewhcJLQRB5"; // String | A base64 encoded value used for pagination of results. + Integer limit = 50; // Integer | The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. + Boolean limitTotalCount = true; // Boolean | When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. + try { + MessagesList result = apiInstance.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MessagesApi#listMessages"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **messageId** | **String**| The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. | [optional] | +| **sourceTn** | **String**| The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **destinationTn** | **String**| The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). | [optional] | +| **messageStatus** | [**MessageStatusEnum**](.md)| The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. | [optional] [enum: RECEIVED, QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED] | +| **messageDirection** | [**ListMessageDirectionEnum**](.md)| The direction of the message. One of INBOUND OUTBOUND. | [optional] [enum: INBOUND, OUTBOUND] | +| **carrierName** | **String**| The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). | [optional] | +| **messageType** | [**MessageTypeEnum**](.md)| The type of message. Either sms or mms. | [optional] [enum: sms, mms] | +| **errorCode** | **Integer**| The error code of the message. | [optional] | +| **fromDateTime** | **String**| The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **toDateTime** | **String**| The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. | [optional] | +| **campaignId** | **String**| The campaign ID of the message. | [optional] | +| **sort** | **String**| The field and direction to sort by combined with a colon. Direction is either asc or desc. | [optional] | +| **pageToken** | **String**| A base64 encoded value used for pagination of results. | [optional] | +| **limit** | **Integer**| The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. | [optional] | +| **limitTotalCount** | **Boolean**| When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. | [optional] | + +### Return type + +[**MessagesList**](MessagesList.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + diff --git a/docs/MessagesList.md b/docs/MessagesList.md new file mode 100644 index 00000000..f352ff4a --- /dev/null +++ b/docs/MessagesList.md @@ -0,0 +1,15 @@ + + +# MessagesList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**totalCount** | **Integer** | The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000. | [optional] | +|**pageInfo** | [**PageInfo**](PageInfo.md) | | [optional] | +|**messages** | [**List<ListMessageItem>**](ListMessageItem.md) | | [optional] | + + + diff --git a/docs/MessagingCodeResponse.md b/docs/MessagingCodeResponse.md new file mode 100644 index 00000000..832fa98f --- /dev/null +++ b/docs/MessagingCodeResponse.md @@ -0,0 +1,13 @@ + + +# MessagingCodeResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**messageId** | **String** | Messaging API Message ID. | [optional] | + + + diff --git a/docs/MessagingRequestError.md b/docs/MessagingRequestError.md new file mode 100644 index 00000000..a7f7cdc3 --- /dev/null +++ b/docs/MessagingRequestError.md @@ -0,0 +1,14 @@ + + +# MessagingRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | | +|**description** | **String** | | | + + + diff --git a/docs/MfaApi.md b/docs/MfaApi.md new file mode 100644 index 00000000..34b407d2 --- /dev/null +++ b/docs/MfaApi.md @@ -0,0 +1,234 @@ +# MfaApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**generateMessagingCode**](MfaApi.md#generateMessagingCode) | **POST** /accounts/{accountId}/code/messaging | Messaging Authentication Code | +| [**generateVoiceCode**](MfaApi.md#generateVoiceCode) | **POST** /accounts/{accountId}/code/voice | Voice Authentication Code | +| [**verifyCode**](MfaApi.md#verifyCode) | **POST** /accounts/{accountId}/code/verify | Verify Authentication Code | + + + +# **generateMessagingCode** +> MessagingCodeResponse generateMessagingCode(accountId, codeRequest) + +Messaging Authentication Code + +Send an MFA code via text message (SMS). + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MfaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CodeRequest codeRequest = new CodeRequest(); // CodeRequest | MFA code request body. + try { + MessagingCodeResponse result = apiInstance.generateMessagingCode(accountId, codeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#generateMessagingCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **codeRequest** | [**CodeRequest**](CodeRequest.md)| MFA code request body. | | + +### Return type + +[**MessagingCodeResponse**](MessagingCodeResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **500** | Internal Server Error | - | + + +# **generateVoiceCode** +> VoiceCodeResponse generateVoiceCode(accountId, codeRequest) + +Voice Authentication Code + +Send an MFA Code via a phone call. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MfaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + CodeRequest codeRequest = new CodeRequest(); // CodeRequest | MFA code request body. + try { + VoiceCodeResponse result = apiInstance.generateVoiceCode(accountId, codeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#generateVoiceCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **codeRequest** | [**CodeRequest**](CodeRequest.md)| MFA code request body. | | + +### Return type + +[**VoiceCodeResponse**](VoiceCodeResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **500** | Internal Server Error | - | + + +# **verifyCode** +> VerifyCodeResponse verifyCode(accountId, verifyCodeRequest) + +Verify Authentication Code + +Verify a previously sent MFA code. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.MfaApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + MfaApi apiInstance = new MfaApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + VerifyCodeRequest verifyCodeRequest = new VerifyCodeRequest(); // VerifyCodeRequest | MFA code verify request body. + try { + VerifyCodeResponse result = apiInstance.verifyCode(accountId, verifyCodeRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MfaApi#verifyCode"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **verifyCodeRequest** | [**VerifyCodeRequest**](VerifyCodeRequest.md)| MFA code verify request body. | | + +### Return type + +[**VerifyCodeResponse**](VerifyCodeResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + diff --git a/docs/MfaForbiddenRequestError.md b/docs/MfaForbiddenRequestError.md new file mode 100644 index 00000000..7a9611f3 --- /dev/null +++ b/docs/MfaForbiddenRequestError.md @@ -0,0 +1,13 @@ + + +# MfaForbiddenRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message** | **String** | The message containing the reason behind the request being forbidden. | [optional] | + + + diff --git a/docs/MfaRequestError.md b/docs/MfaRequestError.md new file mode 100644 index 00000000..3b01d275 --- /dev/null +++ b/docs/MfaRequestError.md @@ -0,0 +1,14 @@ + + +# MfaRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**error** | **String** | A message describing the error with your request. | [optional] | +|**requestId** | **String** | The associated requestId from AWS. | [optional] | + + + diff --git a/docs/MfaUnauthorizedRequestError.md b/docs/MfaUnauthorizedRequestError.md new file mode 100644 index 00000000..7f7de3c5 --- /dev/null +++ b/docs/MfaUnauthorizedRequestError.md @@ -0,0 +1,13 @@ + + +# MfaUnauthorizedRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message** | **String** | Unauthorized | [optional] | + + + diff --git a/docs/PageInfo.md b/docs/PageInfo.md new file mode 100644 index 00000000..0a69589e --- /dev/null +++ b/docs/PageInfo.md @@ -0,0 +1,16 @@ + + +# PageInfo + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**prevPage** | **String** | The link to the previous page for pagination. | [optional] | +|**nextPage** | **String** | The link to the next page for pagination. | [optional] | +|**prevPageToken** | **String** | The isolated pagination token for the previous page. | [optional] | +|**nextPageToken** | **String** | The isolated pagination token for the next page. | [optional] | + + + diff --git a/docs/PhoneNumberLookupApi.md b/docs/PhoneNumberLookupApi.md new file mode 100644 index 00000000..be6defa2 --- /dev/null +++ b/docs/PhoneNumberLookupApi.md @@ -0,0 +1,162 @@ +# PhoneNumberLookupApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**createLookup**](PhoneNumberLookupApi.md#createLookup) | **POST** /accounts/{accountId}/tnlookup | Create Lookup | +| [**getLookupStatus**](PhoneNumberLookupApi.md#getLookupStatus) | **GET** /accounts/{accountId}/tnlookup/{requestId} | Get Lookup Request Status | + + + +# **createLookup** +> CreateLookupResponse createLookup(accountId, lookupRequest) + +Create Lookup + +Create a Phone Number Lookup Request. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.PhoneNumberLookupApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + LookupRequest lookupRequest = new LookupRequest(); // LookupRequest | Phone number lookup request. + try { + CreateLookupResponse result = apiInstance.createLookup(accountId, lookupRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PhoneNumberLookupApi#createLookup"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **lookupRequest** | [**LookupRequest**](LookupRequest.md)| Phone number lookup request. | | + +### Return type + +[**CreateLookupResponse**](CreateLookupResponse.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **202** | Accepted | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + + +# **getLookupStatus** +> LookupStatus getLookupStatus(accountId, requestId) + +Get Lookup Request Status + +Get an existing Phone Number Lookup Request. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.PhoneNumberLookupApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String requestId = "004223a0-8b17-41b1-bf81-20732adf5590"; // String | The phone number lookup request ID from Bandwidth. + try { + LookupStatus result = apiInstance.getLookupStatus(accountId, requestId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PhoneNumberLookupApi#getLookupStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **requestId** | **String**| The phone number lookup request ID from Bandwidth. | | + +### Return type + +[**LookupStatus**](LookupStatus.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **429** | Too Many Requests | - | +| **500** | Internal Server Error | - | + diff --git a/docs/PriorityEnum.md b/docs/PriorityEnum.md new file mode 100644 index 00000000..1a44c9af --- /dev/null +++ b/docs/PriorityEnum.md @@ -0,0 +1,13 @@ + + +# PriorityEnum + +## Enum + + +* `DEFAULT` (value: `"default"`) + +* `HIGH` (value: `"high"`) + + + diff --git a/docs/PublishPermissionsEnum.md b/docs/PublishPermissionsEnum.md new file mode 100644 index 00000000..4261c2be --- /dev/null +++ b/docs/PublishPermissionsEnum.md @@ -0,0 +1,13 @@ + + +# PublishPermissionsEnum + +## Enum + + +* `AUDIO` (value: `"AUDIO"`) + +* `VIDEO` (value: `"VIDEO"`) + + + diff --git a/docs/RecordingAvailableCallback.md b/docs/RecordingAvailableCallback.md new file mode 100644 index 00000000..dcdf970f --- /dev/null +++ b/docs/RecordingAvailableCallback.md @@ -0,0 +1,35 @@ + + +# RecordingAvailableCallback + +The Recording Available event is sent after a recording has been processed. It indicates that the recording is available for download. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**channels** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | + + + diff --git a/docs/RecordingCompleteCallback.md b/docs/RecordingCompleteCallback.md new file mode 100644 index 00000000..6292e92f --- /dev/null +++ b/docs/RecordingCompleteCallback.md @@ -0,0 +1,35 @@ + + +# RecordingCompleteCallback + +The Record Complete event is sent after a verb has executed if the call is still active. The BXML returned by this callback is executed next. When the recording is available for download, a Recording Available event will be sent. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**channels** | **Integer** | Always `1` for conference recordings; multi-channel recordings are not supported on conferences. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | + + + diff --git a/docs/RecordingStateEnum.md b/docs/RecordingStateEnum.md new file mode 100644 index 00000000..f80597d7 --- /dev/null +++ b/docs/RecordingStateEnum.md @@ -0,0 +1,13 @@ + + +# RecordingStateEnum + +## Enum + + +* `PAUSED` (value: `"paused"`) + +* `RECORDING` (value: `"recording"`) + + + diff --git a/docs/RecordingsApi.md b/docs/RecordingsApi.md new file mode 100644 index 00000000..51a8a235 --- /dev/null +++ b/docs/RecordingsApi.md @@ -0,0 +1,817 @@ +# RecordingsApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**deleteCallTranscription**](RecordingsApi.md#deleteCallTranscription) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Delete Transcription | +| [**deleteRecording**](RecordingsApi.md#deleteRecording) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Delete Recording | +| [**deleteRecordingMedia**](RecordingsApi.md#deleteRecordingMedia) | **DELETE** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Delete Recording Media | +| [**downloadCallRecording**](RecordingsApi.md#downloadCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media | Download Recording | +| [**getCallRecording**](RecordingsApi.md#getCallRecording) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId} | Get Call Recording | +| [**getCallTranscription**](RecordingsApi.md#getCallTranscription) | **GET** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Get Transcription | +| [**listAccountCallRecordings**](RecordingsApi.md#listAccountCallRecordings) | **GET** /accounts/{accountId}/recordings | Get Call Recordings | +| [**listCallRecordings**](RecordingsApi.md#listCallRecordings) | **GET** /accounts/{accountId}/calls/{callId}/recordings | List Call Recordings | +| [**transcribeCallRecording**](RecordingsApi.md#transcribeCallRecording) | **POST** /accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription | Create Transcription Request | +| [**updateCallRecordingState**](RecordingsApi.md#updateCallRecordingState) | **PUT** /accounts/{accountId}/calls/{callId}/recording | Update Recording | + + + +# **deleteCallTranscription** +> deleteCallTranscription(accountId, callId, recordingId) + +Delete Transcription + +Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + apiInstance.deleteCallTranscription(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteCallTranscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | The transcription was successfully deleted. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **deleteRecording** +> deleteRecording(accountId, callId, recordingId) + +Delete Recording + +Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + apiInstance.deleteRecording(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Recording was deleted. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **deleteRecordingMedia** +> deleteRecordingMedia(accountId, callId, recordingId) + +Delete Recording Media + +Deletes the specified recording's media. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + apiInstance.deleteRecordingMedia(accountId, callId, recordingId); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#deleteRecordingMedia"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | The recording media was successfully deleted. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **downloadCallRecording** +> File downloadCallRecording(accountId, callId, recordingId) + +Download Recording + +Downloads the specified recording. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + File result = apiInstance.downloadCallRecording(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#downloadCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +[**File**](File.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: audio/vnd.wave, audio/mpeg, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Media found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getCallRecording** +> CallRecordingMetadata getCallRecording(accountId, callId, recordingId) + +Get Call Recording + +Returns metadata for the specified recording. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + CallRecordingMetadata result = apiInstance.getCallRecording(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#getCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +[**CallRecordingMetadata**](CallRecordingMetadata.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Recording found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **getCallTranscription** +> TranscriptionList getCallTranscription(accountId, callId, recordingId) + +Get Transcription + +Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + try { + TranscriptionList result = apiInstance.getCallTranscription(accountId, callId, recordingId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#getCallTranscription"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | + +### Return type + +[**TranscriptionList**](TranscriptionList.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Transcription found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **listAccountCallRecordings** +> List<CallRecordingMetadata> listAccountCallRecordings(accountId, to, from, minStartTime, maxStartTime) + +Get Call Recordings + +Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String to = "%2b19195551234"; // String | Filter results by the `to` field. + String from = "%2b19195554321"; // String | Filter results by the `from` field. + String minStartTime = "2022-06-21T19:13:21Z"; // String | Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). + String maxStartTime = "2022-06-21T19:13:21Z"; // String | Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). + try { + List result = apiInstance.listAccountCallRecordings(accountId, to, from, minStartTime, maxStartTime); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#listAccountCallRecordings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **to** | **String**| Filter results by the `to` field. | [optional] | +| **from** | **String**| Filter results by the `from` field. | [optional] | +| **minStartTime** | **String**| Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). | [optional] | +| **maxStartTime** | **String**| Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). | [optional] | + +### Return type + +[**List<CallRecordingMetadata>**](CallRecordingMetadata.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Recordings retrieved successfully | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **listCallRecordings** +> List<CallRecordingMetadata> listCallRecordings(accountId, callId) + +List Call Recordings + +Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + try { + List result = apiInstance.listCallRecordings(accountId, callId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#listCallRecordings"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | + +### Return type + +[**List<CallRecordingMetadata>**](CallRecordingMetadata.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Recordings retrieved successfully | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **transcribeCallRecording** +> transcribeCallRecording(accountId, callId, recordingId, transcribeRecording) + +Create Transcription Request + +Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Recording ID. + TranscribeRecording transcribeRecording = new TranscribeRecording(); // TranscribeRecording | + try { + apiInstance.transcribeCallRecording(accountId, callId, recordingId, transcribeRecording); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#transcribeCallRecording"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **recordingId** | **String**| Programmable Voice API Recording ID. | | +| **transcribeRecording** | [**TranscribeRecording**](TranscribeRecording.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **204** | Transcription was successfully requested. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + + +# **updateCallRecordingState** +> updateCallRecordingState(accountId, callId, updateCallRecording) + +Update Recording + +Pause or resume a recording on an active phone call. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.RecordingsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + RecordingsApi apiInstance = new RecordingsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85"; // String | Programmable Voice API Call ID. + UpdateCallRecording updateCallRecording = new UpdateCallRecording(); // UpdateCallRecording | + try { + apiInstance.updateCallRecordingState(accountId, callId, updateCallRecording); + } catch (ApiException e) { + System.err.println("Exception when calling RecordingsApi#updateCallRecordingState"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | +| **callId** | **String**| Programmable Voice API Call ID. | | +| **updateCallRecording** | [**UpdateCallRecording**](UpdateCallRecording.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Recording state was successfully modified. | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + diff --git a/docs/RedirectCallback.md b/docs/RedirectCallback.md new file mode 100644 index 00000000..adaecd0e --- /dev/null +++ b/docs/RedirectCallback.md @@ -0,0 +1,29 @@ + + +# RedirectCallback + +The Redirect event is fired when a verb is executed. Its purpose is to get the next set of verbs from the calling application. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | + + + diff --git a/docs/RedirectMethodEnum.md b/docs/RedirectMethodEnum.md new file mode 100644 index 00000000..5a86ed40 --- /dev/null +++ b/docs/RedirectMethodEnum.md @@ -0,0 +1,13 @@ + + +# RedirectMethodEnum + +## Enum + + +* `GET` (value: `"GET"`) + +* `POST` (value: `"POST"`) + + + diff --git a/docs/RequestError.md b/docs/RequestError.md new file mode 100644 index 00000000..7c081aa3 --- /dev/null +++ b/docs/RequestError.md @@ -0,0 +1,14 @@ + + +# RequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**error** | **String** | A message describing the error with your request. | [optional] | +|**requestId** | **String** | The associated requestId from AWS. | [optional] | + + + diff --git a/docs/StatisticsApi.md b/docs/StatisticsApi.md new file mode 100644 index 00000000..4d6af4be --- /dev/null +++ b/docs/StatisticsApi.md @@ -0,0 +1,85 @@ +# StatisticsApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**getStatistics**](StatisticsApi.md#getStatistics) | **GET** /accounts/{accountId}/statistics | Get Account Statistics | + + + +# **getStatistics** +> AccountStatistics getStatistics(accountId) + +Get Account Statistics + +Returns details about the current state of the account. + +### Example +```java +// Import classes: +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.auth.*; +import com.bandwidth.sdk.models.*; +import com.bandwidth.sdk.api.StatisticsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + // Configure HTTP basic authorization: Basic + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + Basic.setUsername("YOUR USERNAME"); + Basic.setPassword("YOUR PASSWORD"); + + StatisticsApi apiInstance = new StatisticsApi(defaultClient); + String accountId = "9900000"; // String | Your Bandwidth Account ID. + try { + AccountStatistics result = apiInstance.getStatistics(accountId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StatisticsApi#getStatistics"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **accountId** | **String**| Your Bandwidth Account ID. | | + +### Return type + +[**AccountStatistics**](AccountStatistics.md) + +### Authorization + +[Basic](../README.md#Basic) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Statistics Found | - | +| **400** | Bad Request | - | +| **401** | Unauthorized | - | +| **403** | Forbidden | - | +| **404** | Not Found | - | +| **405** | Method Not Allowed | - | +| **415** | Unsupported Media Type | - | +| **429** | Too Many Requests | * Retry-After - When you should try your request again.
| +| **500** | Internal Server Error | - | + diff --git a/docs/StirShaken.md b/docs/StirShaken.md new file mode 100644 index 00000000..79d7667d --- /dev/null +++ b/docs/StirShaken.md @@ -0,0 +1,15 @@ + + +# StirShaken + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**verstat** | **String** | (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Verification-Passed and TN-Verification-Failed. | [optional] | +|**attestationIndicator** | **String** | (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). | [optional] | +|**originatingId** | **String** | (optional) A unique origination identifier. | [optional] | + + + diff --git a/docs/Tag.md b/docs/Tag.md new file mode 100644 index 00000000..44fd74fd --- /dev/null +++ b/docs/Tag.md @@ -0,0 +1,14 @@ + + +# Tag + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**key** | **String** | | [optional] | +|**value** | **String** | | [optional] | + + + diff --git a/docs/TnLookupRequestError.md b/docs/TnLookupRequestError.md new file mode 100644 index 00000000..d41f290c --- /dev/null +++ b/docs/TnLookupRequestError.md @@ -0,0 +1,13 @@ + + +# TnLookupRequestError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message** | **String** | A description of what validation error occurred. | [optional] | + + + diff --git a/docs/TranscribeRecording.md b/docs/TranscribeRecording.md new file mode 100644 index 00000000..5a30cd0e --- /dev/null +++ b/docs/TranscribeRecording.md @@ -0,0 +1,19 @@ + + +# TranscribeRecording + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callbackUrl** | **URI** | The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization. | [optional] | +|**callbackMethod** | **CallbackMethodEnum** | | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**callbackTimeout** | **Double** | This is the timeout (in seconds) to use when delivering the webhook to `callbackUrl`. Can be any numeric value (including decimals) between 1 and 25. | [optional] | +|**detectLanguage** | **Boolean** | A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. | [optional] | + + + diff --git a/docs/Transcription.md b/docs/Transcription.md new file mode 100644 index 00000000..009de6b6 --- /dev/null +++ b/docs/Transcription.md @@ -0,0 +1,14 @@ + + +# Transcription + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**text** | **String** | The transcribed text | [optional] | +|**confidence** | **Double** | The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. | [optional] | + + + diff --git a/docs/TranscriptionAvailableCallback.md b/docs/TranscriptionAvailableCallback.md new file mode 100644 index 00000000..d560cae6 --- /dev/null +++ b/docs/TranscriptionAvailableCallback.md @@ -0,0 +1,34 @@ + + +# TranscriptionAvailableCallback + +The Transcription Available event is sent when the recording transcription is available to be downloaded. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**mediaUrl** | **URI** | The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**recordingId** | **String** | The unique ID of this recording | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**duration** | **String** | The duration of the recording in ISO-8601 format | [optional] | +|**fileFormat** | **FileFormatEnum** | | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transcription** | [**Transcription**](Transcription.md) | | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | + + + diff --git a/docs/TranscriptionList.md b/docs/TranscriptionList.md new file mode 100644 index 00000000..0e83feba --- /dev/null +++ b/docs/TranscriptionList.md @@ -0,0 +1,13 @@ + + +# TranscriptionList + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**transcripts** | [**List<Transcription>**](Transcription.md) | | [optional] | + + + diff --git a/docs/TranscriptionMetadata.md b/docs/TranscriptionMetadata.md new file mode 100644 index 00000000..115f86da --- /dev/null +++ b/docs/TranscriptionMetadata.md @@ -0,0 +1,17 @@ + + +# TranscriptionMetadata + +If the recording was transcribed, metadata about the transcription + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **String** | The unique transcription ID | [optional] | +|**status** | **String** | The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. | [optional] | +|**completedTime** | **String** | The time that the transcription was completed | [optional] | +|**url** | **URI** | The URL of the [transcription](#operation/getCallTranscription) | [optional] | + + + diff --git a/docs/TransferAnswerCallback.md b/docs/TransferAnswerCallback.md new file mode 100644 index 00000000..a8fdeeb2 --- /dev/null +++ b/docs/TransferAnswerCallback.md @@ -0,0 +1,28 @@ + + +# TransferAnswerCallback + +When processing a verb, this event is sent when a called party (B-leg) answers. The event is sent to the endpoint specified in the transferAnswerUrl attribute of the tag that answered. BXML returned by this callback will be executed for the called party only. After all BXML has been executed, the called party will be bridged to the original call. Most BXML verbs are allowed in response to a transferAnswer event, but some are not allowed. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | + + + diff --git a/docs/TransferCompleteCallback.md b/docs/TransferCompleteCallback.md new file mode 100644 index 00000000..97845e7e --- /dev/null +++ b/docs/TransferCompleteCallback.md @@ -0,0 +1,31 @@ + + +# TransferCompleteCallback + +This event is sent to the transferCompleteUrl of the A-leg's verb when the transferred call (B-leg) completes. In a simultaneous ringing scenario, only one B-leg succeeds and this event corresponds to that successful leg. If none of the calls were answered, the transferComplete event corresponds to one of the legs. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | +|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | +|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | +|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | + + + diff --git a/docs/TransferDisconnectCallback.md b/docs/TransferDisconnectCallback.md new file mode 100644 index 00000000..3e7f4c7a --- /dev/null +++ b/docs/TransferDisconnectCallback.md @@ -0,0 +1,33 @@ + + +# TransferDisconnectCallback + +This event is sent to the transferDisconnectUrl of each tag when its respective call leg ends for any reason. The event is sent in the normal case, when the transferred leg is answered and later hung up, but is also sent if the new leg was never answered in the first place, if it was rejected, and if the original call leg hung up before the transferred leg. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**eventType** | **String** | The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. | [optional] | +|**eventTime** | **OffsetDateTime** | The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. | [optional] | +|**accountId** | **String** | The user account associated with the call. | [optional] | +|**applicationId** | **String** | The id of the application associated with the call. | [optional] | +|**from** | **String** | The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. | [optional] | +|**to** | **String** | The phone number that received the call, in E.164 format (e.g. +15555555555). | [optional] | +|**direction** | **CallDirectionEnum** | | [optional] | +|**callId** | **String** | The call id associated with the event. | [optional] | +|**callUrl** | **String** | The URL of the call associated with the event. | [optional] | +|**parentCallId** | **String** | (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. | [optional] | +|**enqueuedTime** | **OffsetDateTime** | (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. | [optional] | +|**startTime** | **OffsetDateTime** | Time the call was started, in ISO 8601 format. | [optional] | +|**answerTime** | **OffsetDateTime** | Time the call was answered, in ISO 8601 format. | [optional] | +|**endTime** | **OffsetDateTime** | The time that the recording ended in ISO-8601 format | [optional] | +|**tag** | **String** | (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. | [optional] | +|**transferCallerId** | **String** | The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. | [optional] | +|**transferTo** | **String** | The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). | [optional] | +|**cause** | **String** | Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. | [optional] | +|**errorMessage** | **String** | Text explaining the reason that caused the call to fail in case of errors. | [optional] | +|**errorId** | **String** | Bandwidth's internal id that references the error event. | [optional] | + + + diff --git a/docs/UnauthorizedRequest.md b/docs/UnauthorizedRequest.md new file mode 100644 index 00000000..f14c39e9 --- /dev/null +++ b/docs/UnauthorizedRequest.md @@ -0,0 +1,13 @@ + + +# UnauthorizedRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**message** | **String** | Unauthorized | [optional] | + + + diff --git a/docs/UpdateCall.md b/docs/UpdateCall.md new file mode 100644 index 00000000..98184a4f --- /dev/null +++ b/docs/UpdateCall.md @@ -0,0 +1,22 @@ + + +# UpdateCall + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**state** | **CallStateEnum** | | [optional] | +|**redirectUrl** | **URI** | The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`. | [optional] | +|**redirectMethod** | **RedirectMethodEnum** | | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**redirectFallbackUrl** | **URI** | A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. | [optional] | +|**redirectFallbackMethod** | **RedirectMethodEnum** | | [optional] | +|**fallbackUsername** | **String** | Basic auth username. | [optional] | +|**fallbackPassword** | **String** | Basic auth password. | [optional] | +|**tag** | **String** | A custom string that will be sent with this and all future callbacks unless overwritten by a future `tag` attribute or [`<Tag>`](/docs/voice/bxml/tag) verb, or cleared. May be cleared by setting `tag=\"\"`. Max length 256 characters. Not allowed if `state` is `completed`. | [optional] | + + + diff --git a/docs/UpdateCallRecording.md b/docs/UpdateCallRecording.md new file mode 100644 index 00000000..13afa270 --- /dev/null +++ b/docs/UpdateCallRecording.md @@ -0,0 +1,13 @@ + + +# UpdateCallRecording + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**state** | **RecordingStateEnum** | | | + + + diff --git a/docs/UpdateConference.md b/docs/UpdateConference.md new file mode 100644 index 00000000..f0ebb9ac --- /dev/null +++ b/docs/UpdateConference.md @@ -0,0 +1,21 @@ + + +# UpdateConference + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **ConferenceStateEnum** | | [optional] | +|**redirectUrl** | **URI** | The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`. | [optional] | +|**redirectMethod** | **RedirectMethodEnum** | | [optional] | +|**username** | **String** | Basic auth username. | [optional] | +|**password** | **String** | Basic auth password. | [optional] | +|**redirectFallbackUrl** | **URI** | A fallback url which, if provided, will be used to retry the `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not allowed if `state` is `completed`. | [optional] | +|**redirectFallbackMethod** | **RedirectMethodEnum** | | [optional] | +|**fallbackUsername** | **String** | Basic auth username. | [optional] | +|**fallbackPassword** | **String** | Basic auth password. | [optional] | + + + diff --git a/docs/UpdateConferenceMember.md b/docs/UpdateConferenceMember.md new file mode 100644 index 00000000..24b80cc4 --- /dev/null +++ b/docs/UpdateConferenceMember.md @@ -0,0 +1,15 @@ + + +# UpdateConferenceMember + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**mute** | **Boolean** | Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted. | [optional] | +|**hold** | **Boolean** | Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. Updates this member's hold status. Has no effect if omitted. | [optional] | +|**callIdsToCoach** | **List<String>** | If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. | [optional] | + + + diff --git a/docs/VerifyCodeRequest.md b/docs/VerifyCodeRequest.md new file mode 100644 index 00000000..083a59b7 --- /dev/null +++ b/docs/VerifyCodeRequest.md @@ -0,0 +1,16 @@ + + +# VerifyCodeRequest + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**to** | **String** | The phone number to send the mfa code to. | | +|**scope** | **String** | An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". | [optional] | +|**expirationTimeInMinutes** | **BigDecimal** | The time period, in minutes, to validate the mfa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. | | +|**code** | **String** | The generated mfa code to check if valid. | | + + + diff --git a/docs/VerifyCodeResponse.md b/docs/VerifyCodeResponse.md new file mode 100644 index 00000000..f49bfcb9 --- /dev/null +++ b/docs/VerifyCodeResponse.md @@ -0,0 +1,13 @@ + + +# VerifyCodeResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**valid** | **Boolean** | Whether or not the supplied code is valid. | [optional] | + + + diff --git a/docs/VoiceApiError.md b/docs/VoiceApiError.md new file mode 100644 index 00000000..01746edf --- /dev/null +++ b/docs/VoiceApiError.md @@ -0,0 +1,15 @@ + + +# VoiceApiError + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**type** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**id** | **String** | | [optional] | + + + diff --git a/docs/VoiceCodeResponse.md b/docs/VoiceCodeResponse.md new file mode 100644 index 00000000..13779e2e --- /dev/null +++ b/docs/VoiceCodeResponse.md @@ -0,0 +1,13 @@ + + +# VoiceCodeResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**callId** | **String** | Programmable Voice API Call ID. | [optional] | + + + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..a3408578 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,6 @@ +# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator). +# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option. +# +# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties +# For example, uncomment below to build for Android +#target = android diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..7454180f Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..ffed3a25 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100644 index 00000000..005bcde0 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..6a68175e --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/openapi-config.yml b/openapi-config.yml new file mode 100644 index 00000000..4a07b482 --- /dev/null +++ b/openapi-config.yml @@ -0,0 +1,13 @@ +artifactId: bandwidth-sdk +artifactVersion: 9.0.0 +artifactDescription: The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs +artifactUrl: https://github.com/Bandwidth/java-sdk +developerEmail: dx@bandwidth.com +developerOrganization: Bandwidth +disallowAdditionalPropertiesIfNotPresent: false +groupId: com.bandwidth.sdk +invokerPackage: com.bandwidth.sdk +apiPackage: com.bandwidth.sdk.api +modelPackage: com.bandwidth.sdk.model +library: okhttp-gson +licenseName: MIT diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 00000000..27e6d53b --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.2.0" + } +} diff --git a/pom.xml b/pom.xml index 6d2151be..42bf2633 100644 --- a/pom.xml +++ b/pom.xml @@ -1,249 +1,427 @@ - - - 4.0.0 - - com.bandwidth.sdk - bandwidth-sdk - 2.0.0 - jar - - BandwidthLib - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - [2.0.0,) - - enforce - - - - - true - - - - - - - - - - - - org.codehaus.mojo - versions-maven-plugin - 2.5 - - file://${project.basedir}/version-rules.xml - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.0.0-M2 - - - enforce-versions - - enforce - - - true - - - 1.8 - - - - - - - - maven-assembly-plugin - - - jar-with-dependencies - - false - - - - org.apache.maven.plugins - maven-source-plugin - 3.1.0 - - - attach-sources - - jar - - - - - - org.apache.maven.plugins - maven-gpg-plugin - 3.0.1 - - - sign-artifacts - verify - - sign - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.2 - true - - ossrh - https://oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - false - - - - attach-javadocs - - jar - - - - - - - - - 2.13.2 - 2.13.2.1 - 1.8 - 1.8 - UTF-8 - - - - - - javax.xml.bind - jaxb-api - 2.3.0 - - - javax.activation - activation - 1.1.1 - - - javax.annotation - javax.annotation-api - 1.3.2 - - - com.sun.xml.bind - jaxb-core - 2.3.0 - - - com.sun.xml.bind - jaxb-impl - 2.3.0 - - - org.projectlombok - lombok - 1.18.20 - - - - com.squareup.okhttp3 - okhttp - [3.12, 4.9.2] - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.databind.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - junit - junit - 4.13.1 - test - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - org.sonatype.oss - oss-parent - 7 - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - https://github.com/Bandwidth/java-sdk - scm:git:git@github.com:Bandwidth/java-sdk.git - scm:git:git@github.com:Bandwidth/java-sdk.git - - - - support - Bandwidth Support - info@bandwidth.com - Bandwidth, Inc. - http://bandwidth.com - -5 - - - + + 4.0.0 + com.bandwidth.sdk + bandwidth-sdk + jar + bandwidth-sdk + 9.0.0 + https://github.com/Bandwidth/java-sdk + The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs + + https://github.com/Bandwidth/java-sdk + scm:git:git@github.com:Bandwidth/java-sdk.git + scm:git:git@github.com:Bandwidth/java-sdk.git + + + + + MIT + http://unlicense.org + repo + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + support + Bandwidth Support + info@bandwidth.com + Bandwidth, Inc. + http://bandwidth.com + -5 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + true + 128m + 512m + + -Xlint:all + -J-Xss4m + + true + ${java.version} + ${java.version} + ${java.version} + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + + enforce-maven + + enforce + + + + + + + 3.8.6 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + 10 + + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + + test-jar + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.2.0 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + + attach-javadocs + + jar + + + + + none + + + http.response.details + a + Http Response Details: + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.0 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.2 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + + .gitignore + + + + + + true + 4 + + + + + + + + + + 1.8 + + true + + + + + + + + + + + + + + org.glassfish.jaxb + jaxb-core + ${jaxb.version} + + + org.glassfish.jaxb + jaxb-runtime + ${jaxb.version} + + + org.projectlombok + lombok + 1.18.24 + provided + + + jakarta.xml.bind + jakarta.xml.bind-api + ${jaxb.version} + + + org.hamcrest + hamcrest + 2.2 + + + io.swagger + swagger-annotations + ${swagger-core-version} + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.squareup.okhttp3 + okhttp + ${okhttp-version} + + + com.squareup.okhttp3 + logging-interceptor + ${okhttp-version} + + + com.google.code.gson + gson + ${gson-version} + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.apache.commons + commons-lang3 + ${commons-lang3-version} + + + commons-io + commons-io + ${version.commons-io} + + + jakarta.annotation + jakarta.annotation-api + ${jakarta-annotation-version} + provided + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable-version} + + + javax.ws.rs + jsr311-api + ${jsr311-api-version} + + + javax.ws.rs + javax.ws.rs-api + ${javax.ws.rs-api-version} + + + + org.junit.jupiter + junit-jupiter-engine + ${junit-version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform-runner.version} + test + + + org.mockito + mockito-core + ${mockito-core-version} + test + + + + + 11 + ${java.version} + ${java.version} + + 1.8.5 + 1.6.5 + 4.9.3 + 2.9.0 + 2.11.0 + + 3.12.0 + 4.0.0 + 0.2.3 + + 1.3.5 + 5.8.2 + 1.6.2 + + 3.12.4 + 2.1.1 + 1.1.1 + + UTF-8 + 2.21.0 + + + + + org.projectlombok + lombok + 1.18.24 + provided + + + + diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..3caa85dd --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "bandwidth-sdk" \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 00000000..d469ddbc --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/com/bandwidth/ApiHelper.java b/src/main/java/com/bandwidth/ApiHelper.java deleted file mode 100644 index f3cc8222..00000000 --- a/src/main/java/com/bandwidth/ApiHelper.java +++ /dev/null @@ -1,685 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.request.MultipartFileWrapper; -import com.bandwidth.http.request.MultipartWrapper; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.module.SimpleModule; -import java.io.File; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.math.BigDecimal; -import java.net.URLEncoder; -import java.util.AbstractMap.SimpleEntry; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * This is a Helper class with commonly used utilities for the SDK. - */ -public class ApiHelper { - - // Deserialization of Json data - public static ObjectMapper mapper = new ObjectMapper() { - private static final long serialVersionUID = -174113593500315394L; - { - configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - configOverride(BigDecimal.class).setFormat( - JsonFormat.Value.forShape(JsonFormat.Shape.STRING)); - } - }; - - /** - * List of classes that are wrapped directly. This information is needed when - * traversing object trees for reference matching. - */ - private static final Set WRAPPER_TYPES = new HashSet(Arrays.asList( - Boolean.class, Character.class, Byte.class, Short.class, String.class, - Integer.class, Long.class, Float.class, Double.class, BigDecimal.class, - Void.class, File.class, MultipartWrapper.class, MultipartFileWrapper.class)); - - /** - * Get a JsonSerializer instance from the provided annotation. - * @param serializerAnnotation The Annotation containing information about the serializer. - * @return The JsonSerializer instance of the required type. - */ - @SuppressWarnings("rawtypes") - private static JsonSerializer getSerializer(JsonSerialize serializerAnnotation) { - try { - return serializerAnnotation.using().getDeclaredConstructor().newInstance(); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * Json Serialization of a given object. - * @param obj The object to serialize into Json. - * @return The serialized Json String representation of the given object. - * @throws JsonProcessingException Signals that a Json Processing Exception has occurred. - */ - public static String serialize(Object obj) - throws JsonProcessingException { - if (obj == null) { - return null; - } - - return mapper.writeValueAsString(obj); - } - - /** - * Json Serialization of a given object using a specified JsonSerializer. - * @param obj The object to serialize into Json. - * @param serializer The instance of JsonSerializer to use. - * @return The serialized Json string representation of the given object. - * @throws JsonProcessingException Signals that a Json Processing Exception has occurred. - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public static String serialize(Object obj, final JsonSerializer serializer) - throws JsonProcessingException { - if (obj == null || serializer == null) { - return null; - } - - if (obj.getClass().getName().equals("java.util.ArrayList")) { - // need to find the generic type if it's an ArrayList - final Class cls = ((ArrayList) obj).get(0).getClass(); - - return new ObjectMapper() { - private static final long serialVersionUID = -1639089569991988232L; - { - SimpleModule module = new SimpleModule(); - module.addSerializer(cls, serializer); - this.registerModule(module); - } - }.writeValueAsString(obj); - } - - final Class cls = obj.getClass(); - return new ObjectMapper() { - private static final long serialVersionUID = -1639089569991988232L; - { - SimpleModule module = new SimpleModule(); - module.addSerializer(cls, serializer); - this.registerModule(module); - } - }.writeValueAsString(obj); - } - - /** - * Json deserialization of the given Json string using a specified JsonDerializer. - * @param json The Json string to deserialize. - * @param typeReference TypeReference of list of T. - * @param The type of the object to deserialize into. - * @param cls The class to attach the deserializer to. - * @param deserializer The deserializer to use. - * @return The deserialized object. - * @throws IOException Signals if any I/O exception occured. - */ - public static List deserialize(String json, - final TypeReference> typeReference, final Class cls, - final JsonDeserializer deserializer) throws IOException { - if (isNullOrWhiteSpace(json)) { - return null; - } - - return new ObjectMapper() { - private static final long serialVersionUID = -1639089569991988232L; - { - SimpleModule module = new SimpleModule(); - module.addDeserializer(cls, deserializer); - this.registerModule(module); - } - }.readValue(json, typeReference); - } - - /** - * Json deserialization of the given Json string. - * @param The type of the object to deserialize into - * @param json The Json string to deserialize - * @param clazz The type of the object to deserialize into - * @return The deserialized object - * @throws IOException Signals if any I/O exception occured. - */ - public static T deserialize(String json, Class clazz) - throws IOException { - if (isNullOrWhiteSpace(json)) { - return null; - } - - return mapper.readValue(json, clazz); - } - - /** - * Json deserialization of the given Json string. - * @param json The Json string to deserialize - * @return The deserialized Json as a Map - * @throws IOException Signals if any I/O exception occured. - */ - public static LinkedHashMap deserialize(String json) - throws IOException { - if (isNullOrWhiteSpace(json)) { - return null; - } - - TypeReference> typeRef - = new TypeReference>(){}; - return deserialize(json, typeRef); - } - - /** - * JSON Deserialization of the given json string. - * @param json The json string to deserialize - * @param typeReference TypeReference of T - * @param The type of the object to deserialize into - * @return The deserialized object - * @throws IOException Signals if any I/O exception occured. - */ - public static T deserialize(String json, TypeReference typeReference) - throws IOException { - if (isNullOrWhiteSpace(json)) { - return null; - } - - return mapper.readValue(json, typeReference); - } - - /** - * Json deserialization of the given Json string. - * @param json The Json string to deserialize - * @return The deserialized Json as an Object - */ - public static Object deserializeAsObject(String json) { - if (isNullOrWhiteSpace(json)) { - return null; - } - try { - return ApiHelper.deserialize(json, new TypeReference() {}); - } catch (IOException e) { - // Failed to deserialize when json is not representing a JSON object. - // i.e. either its string or any primitive type. - return json; - } - } - - /** - * JSON Deserialization of the given json string. - * @param The type of the object to deserialize into - * @param json The Json string to deserialize - * @param classArray The class of the array of objects to deserialize into - * @return The deserialized list of objects - * @throws IOException Signals if any I/O exception occured. - */ - public static List deserializeArray(String json, Class classArray) - throws IOException { - if (isNullOrWhiteSpace(json)) { - return null; - } - - return Arrays.asList(mapper.readValue(json, classArray)); - } - - /** - * Populates an object of an ApiException subclass with the required properties. - * @param json The Json string to deserialize - * @param obj The object to populate. - * @throws IOException Signals if any I/O exception occured. - */ - public static void populate(String json, ApiException obj) - throws IOException { - if (!isNullOrWhiteSpace(json)) { - mapper.readerForUpdating(obj).readValue(json); - } - } - - /** - * Replaces template parameters in the given URL. - * @param queryBuilder The query string builder to replace the template parameters - * @param parameters The parameters to replace in the URL - */ - public static void appendUrlWithTemplateParameters(StringBuilder queryBuilder, - Map> parameters) { - // Perform parameter validation - if (null == queryBuilder) { - throw new IllegalArgumentException( - "Given value for parameter \"queryBuilder\" is invalid."); - } - - if (null == parameters) { - return; - } - - // Iterate and append parameters - for (Map.Entry> pair : parameters.entrySet()) { - - String replaceValue = ""; - Object element = pair.getValue().getKey(); - boolean shouldEncode = pair.getValue().getValue(); - - // Load element value as string - if (null == element) { - replaceValue = ""; - } else if (element instanceof Collection) { - replaceValue = flattenCollection("", (Collection) element, shouldEncode, - "%s%s%s", '/'); - } else { - if (shouldEncode) { - replaceValue = tryUrlEncode(element.toString()); - } else { - replaceValue = element.toString(); - } - } - - // Find the template parameter and replace it with its value - replaceAll(queryBuilder, "{" + pair.getKey() + "}", replaceValue); - } - } - - /** - * Appends the given set of parameters to the given query string. - * @param queryBuilder The query URL string to append the parameters. - * @param parameters The parameters to append. - */ - public static void appendUrlWithQueryParameters(StringBuilder queryBuilder, - Map parameters) { - // Perform parameter validation - if (queryBuilder == null) { - throw new IllegalArgumentException( - "Given value for parameter \"queryBuilder\" is invalid."); - } - if (parameters == null || parameters.isEmpty()) { - return; - } - - // Check if query string already has parameters - boolean hasParams = queryBuilder.indexOf("?") > 0; - queryBuilder.append(hasParams ? '&' : '?'); - - encodeObjectAsQueryString("", parameters, queryBuilder); - } - - /** - * Validates if the string is null, empty or whitespace. - * @param s The string to validate. - * @return The result of validation. - */ - public static boolean isNullOrWhiteSpace(String s) { - if (s == null) { - return true; - } - - int length = s.length(); - if (length > 0) { - for (int start = 0, middle = length / 2, end = length - 1; start <= middle; - start++, end--) { - if (s.charAt(start) > ' ' || s.charAt(end) > ' ') { - return false; - } - } - return true; - } - return false; - } - - /** - * Replaces all occurrences of the given string in the string builder. - * @param stringBuilder The string builder to update with replaced strings. - * @param toReplace The string to replace in the string builder. - * @param replaceWith The string to replace with. - */ - public static void replaceAll(StringBuilder stringBuilder, String toReplace, - String replaceWith) { - int index = stringBuilder.indexOf(toReplace); - - while (index != -1) { - stringBuilder.replace(index, index + toReplace.length(), replaceWith); - index += replaceWith.length(); // Move to the end of the replacement - index = stringBuilder.indexOf(toReplace, index); - } - } - - /** - * Removes null values from the given map. - * @param map Map of values. - */ - public static void removeNullValues(Map map) { - if (map == null) { - return; - } - - map.values().removeAll(Collections.singleton(null)); - } - - /** - * Validates and processes the given URL. - * @param url The given URL to process. - * @return Pre-process URL as string. - */ - public static String cleanUrl(StringBuilder url) { - // Ensures that the URLs are absolute - Pattern pattern = Pattern.compile("^(https?://[^/]+)"); - Matcher matcher = pattern.matcher(url); - if (!matcher.find()) { - throw new IllegalArgumentException("Invalid Url format."); - } - - // Get the http protocol match - String protocol = matcher.group(1); - - // Removes redundant forward slashes - String query = url.substring(protocol.length()); - query = query.replaceAll("//+", "/"); - - // Returns processed URL - return protocol.concat(query); - } - - /** - * Prepares Array style form fields from a given array of values. - * @param value Value for the form fields. - * @return Dictionary of form fields created from array elements. - */ - public static List> prepareFormFields(Map value) { - List> formFields = new ArrayList<>(); - if (value != null) { - objectToList("", value, formFields, new HashSet()); - } - return formFields; - } - - /** - * Encodes a given object to URL encoded string. - * @param name Name of the object. - * @param obj Raw object sent from caller. - * @param objBuilder String of elements. - */ - private static void encodeObjectAsQueryString(String name, Object obj, - StringBuilder objBuilder) { - if (obj == null) { - return; - } - - List> objectList = new ArrayList<>(); - objectToList(name, obj, objectList, new HashSet()); - boolean hasParam = false; - - - for (SimpleEntry pair : objectList) { - String paramKeyValPair; - String accessor = pair.getKey(); - // Ignore null - Object value = pair.getValue(); - if (value == null) { - continue; - } - - hasParam = true; - // Load element value as string - paramKeyValPair = String.format("%s=%s&", accessor, tryUrlEncode(value.toString())); - objBuilder.append(paramKeyValPair); - - } - - // Removing the last & - if (hasParam) { - objBuilder.setLength(objBuilder.length() - 1); - } - } - - /** - * Flattening a collection of objects into a string. - * @param array Array of elements to flatten. - * @param fmt Format string to use for array flattening. - * @param separator Separator to use for string concatenation. - * @return Representative string made up of array elements. - */ - private static String flattenCollection(String elemName, Collection array, boolean encode, - String fmt, char separator) { - StringBuilder builder = new StringBuilder(); - - // Append all elements of the array into a string - for (Object element : array) { - String elemValue = null; - - // Replace null values with empty string to maintain index order - if (element == null) { - elemValue = ""; - } else { - elemValue = element.toString(); - } - if (encode) { - elemValue = tryUrlEncode(elemValue); - } - builder.append(String.format(fmt, elemName, elemValue, separator)); - } - - // Remove the last separator, if appended - if ((builder.length() > 1) && (builder.charAt(builder.length() - 1) == separator)) { - builder.deleteCharAt(builder.length() - 1); - } - - return builder.toString(); - } - - /** - * Tries URL encode using UTF-8. - * @param value The value to URL encode. - * @return - */ - private static String tryUrlEncode(String value) { - try { - return URLEncoder.encode(value, "UTF-8"); - } catch (UnsupportedEncodingException ex) { - return value; - } - } - - private static void objectToList(String objName, Collection obj, - List> objectList, HashSet processed) { - - Collection array = obj; - // Append all elements of the array into a string - int index = 0; - for (Object element : array) { - //load key value pair - String key = String.format("%s[%d]", objName, index++); - loadKeyValuePairForEncoding(key, element, objectList, processed); - } - - } - - private static void objectToList(String objName, Map obj, - List> objectList, - HashSet processed) { - // Process map - Map map = obj; - // Append all elements of the array into a string - for (Map.Entry pair : map.entrySet()) { - String attribName = pair.getKey().toString(); - if ((objName != null) && (!objName.isEmpty())) { - attribName = String.format("%s[%s]", objName, attribName); - } - loadKeyValuePairForEncoding(attribName, pair.getValue(), objectList, processed); - } - } - - /** - * Converts a given object to a form encoded map. - * @param objName Name of the object. - * @param obj The object to convert into a map. - * @param objectList The object list to populate. - * @param processed List of object hashCodes that are already parsed. - */ - private static void objectToList(String objName, Object obj, - List> objectList, HashSet processed) { - // Null values need not to be processed - if (obj == null) { - return; - } - - // Wrapper types are autoboxed, so reference checking is not needed - if (!isWrapperType(obj.getClass())) { - // Avoid infinite recursion - if (processed.contains(objName.hashCode())) { - return; - } - processed.add(objName.hashCode()); - } - - // Process arrays - if (obj instanceof Collection) { - objectToList(objName, (Collection) obj, objectList, processed); - } else if (obj.getClass().isArray()) { - // Process array - - Object[] array = (Object[]) obj; - // Append all elements in the array into a string - int index = 0; - for (Object element : array) { - // Load key value pair - String key = String.format("%s[%d]", objName, index++); - loadKeyValuePairForEncoding(key, element, objectList, processed); - } - } else if (obj instanceof Map) { - objectToList(objName, (Map) obj, objectList, processed); - } else { - // Process objects - // Invoke getter methods - Class clazz = obj.getClass(); - while (clazz != null) { - for (Method method : clazz.getDeclaredMethods()) { - - // Is a public/protected getter or internalGetter? - if (method.getParameterTypes().length != 0 - || Modifier.isPrivate(method.getModifiers()) - || (!method.getName().startsWith("get") - && !method.getName().startsWith("internalGet"))) { - continue; - } - - // Get JsonGetter annotation - Annotation getterAnnotation = method.getAnnotation(JsonGetter.class); - if (getterAnnotation == null) { - continue; - } - - // Load key name from getter attribute name - String attribName = ((JsonGetter) getterAnnotation).value(); - if ((objName != null) && (!objName.isEmpty())) { - attribName = String.format("%s[%s]", objName, attribName); - } - - try { - // Load value by invoking getter method - method.setAccessible(true); - Object value = method.invoke(obj); - JsonSerialize serializerAnnotation = method - .getAnnotation(JsonSerialize.class); - // Load key value pair into objectList - if (serializerAnnotation != null) { - loadKeyValuePairForEncoding(attribName, value, objectList, processed, - serializerAnnotation); - } else { - loadKeyValuePairForEncoding(attribName, value, objectList, processed); - } - } catch (IllegalAccessException | IllegalArgumentException - | InvocationTargetException e) { - // This block only calls getter methods. - // These getters don't throw any exception except invocationTargetException. - // The getters are public so there is no chance of an IllegalAccessException - // Steps we've followed ensure that the object has the specified method. - } - } - clazz = clazz.getSuperclass(); - } - } - } - - /** - * While processing objects to map, decides whether to perform recursion or load value. - * @param key The key for creating key value pair. - * @param value The value to process against the given key. - * @param objectList The object list to process with key value pair. - * @param processed List of processed objects hashCodes. - */ - private static void loadKeyValuePairForEncoding(String key, Object value, - List> objectList, HashSet processed) { - if (value == null) { - return; - } - if (isWrapperType(value)) { - objectList.add(new SimpleEntry(key, value)); - } else if (value instanceof UUID) { - // UUIDs can be converted to string - objectList.add(new SimpleEntry(key, value.toString())); - } else { - objectToList(key, value, objectList, processed); - } - } - - /** - * While processing objects to map, loads value after serializing. - * @param key The key to used for creation of key value pair. - * @param value The value to process against the given key. - * @param objectList The object list to process with key value pair. - * @param processed List of processed objects hashCodes. - * @param serializerAnnotation Annotation for serializer - */ - @SuppressWarnings("unused") - private static void loadKeyValuePairForEncoding(String key, Object value, - List> objectList, HashSet processed, - JsonSerialize serializerAnnotation) { - if (value == null) { - return; - } - - try { - value = serialize(value, getSerializer(serializerAnnotation)); - if (value.toString().startsWith("\"")) { - value = value.toString().substring(1, value.toString().length() - 1); - } - objectList.add(new SimpleEntry(key, value)); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } - } - - /** - * Check if the given object can be wrapped directly. - * @param object The given object. - * @return true if the class is an autoboxed class e.g., Integer. - */ - private static boolean isWrapperType(Object object) { - return WRAPPER_TYPES.contains(object.getClass()) - || object.getClass().isPrimitive() || object.getClass().isEnum(); - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/AuthManager.java b/src/main/java/com/bandwidth/AuthManager.java deleted file mode 100644 index 6d669ad9..00000000 --- a/src/main/java/com/bandwidth/AuthManager.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.request.HttpRequest; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; - -/** - * Interface for defining the behavior of Authentication Classes. - */ -public interface AuthManager { - - /** - * Adds authentication to the given HttpRequest. - * @param httpRequest HttpRequest object for authentication - * @return Returns the object of HttpRequest - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - HttpRequest apply(HttpRequest httpRequest) throws ApiException, IOException; - - /** - * Asynchronously adds authentication to the given HttpRequest. - * @param httpRequest HttpRequest object for authentication - * @return Returns the completable future of HttpRequest - */ - CompletableFuture applyAsync(HttpRequest httpRequest); -} diff --git a/src/main/java/com/bandwidth/BandwidthClient.java b/src/main/java/com/bandwidth/BandwidthClient.java deleted file mode 100644 index 0458f14a..00000000 --- a/src/main/java/com/bandwidth/BandwidthClient.java +++ /dev/null @@ -1,620 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpClientConfiguration; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.http.client.ReadonlyHttpClientConfiguration; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Consumer; - -/** - * Gateway class for the library. - * This class acts as a factory for Controllers. - * It holds the state of the SDK. - */ -public final class BandwidthClient implements Configuration { - - /** - * Private store for clients. - */ - private MessagingClient messagingClient; - private MultiFactorAuthClient multiFactorAuthClient; - private PhoneNumberLookupClient phoneNumberLookupClient; - private VoiceClient voiceClient; - private WebRtcClient webRtcClient; - - /** - * Current API environment. - */ - private final Environment environment; - - /** - * baseUrl value. - */ - private final String baseUrl; - - /** - * The HTTP Client instance to use for making HTTP requests. - */ - private final HttpClient httpClient; - - /** - * Http Client Configuration instance. - */ - private final ReadonlyHttpClientConfiguration httpClientConfig; - - /** - * MessagingBasicAuthManager. - */ - private MessagingBasicAuthManager messagingBasicAuthManager; - - /** - * MultiFactorAuthBasicAuthManager. - */ - private MultiFactorAuthBasicAuthManager multiFactorAuthBasicAuthManager; - - /** - * PhoneNumberLookupBasicAuthManager. - */ - private PhoneNumberLookupBasicAuthManager phoneNumberLookupBasicAuthManager; - - /** - * VoiceBasicAuthManager. - */ - private VoiceBasicAuthManager voiceBasicAuthManager; - - /** - * WebRtcBasicAuthManager. - */ - private WebRtcBasicAuthManager webRtcBasicAuthManager; - - /** - * Map of authentication Managers. - */ - private Map authManagers; - - /** - * Callback to be called before and after the HTTP call for an endpoint is made. - */ - private final HttpCallback httpCallback; - - private BandwidthClient(Environment environment, String baseUrl, HttpClient httpClient, - ReadonlyHttpClientConfiguration httpClientConfig, String messagingBasicAuthUserName, - String messagingBasicAuthPassword, String multiFactorAuthBasicAuthUserName, - String multiFactorAuthBasicAuthPassword, String phoneNumberLookupBasicAuthUserName, - String phoneNumberLookupBasicAuthPassword, String voiceBasicAuthUserName, - String voiceBasicAuthPassword, String webRtcBasicAuthUserName, - String webRtcBasicAuthPassword, Map authManagers, - HttpCallback httpCallback) { - this.environment = environment; - this.baseUrl = baseUrl; - this.httpClient = httpClient; - this.httpClientConfig = httpClientConfig; - this.httpCallback = httpCallback; - - this.authManagers = (authManagers == null) ? new HashMap<>() : new HashMap<>(authManagers); - if (this.authManagers.containsKey("messaging")) { - this.messagingBasicAuthManager = - (MessagingBasicAuthManager) this.authManagers.get("messaging"); - } - - if (!this.authManagers.containsKey("messaging") - || !getMessagingBasicAuthCredentials().equals(messagingBasicAuthUserName, - messagingBasicAuthPassword)) { - this.messagingBasicAuthManager = new MessagingBasicAuthManager( - messagingBasicAuthUserName, messagingBasicAuthPassword); - this.authManagers.put("messaging", messagingBasicAuthManager); - } - - if (this.authManagers.containsKey("multiFactorAuth")) { - this.multiFactorAuthBasicAuthManager = - (MultiFactorAuthBasicAuthManager) this.authManagers.get("multiFactorAuth"); - } - - if (!this.authManagers.containsKey("multiFactorAuth") - || !getMultiFactorAuthBasicAuthCredentials().equals( - multiFactorAuthBasicAuthUserName, multiFactorAuthBasicAuthPassword)) { - this.multiFactorAuthBasicAuthManager = new MultiFactorAuthBasicAuthManager( - multiFactorAuthBasicAuthUserName, multiFactorAuthBasicAuthPassword); - this.authManagers.put("multiFactorAuth", multiFactorAuthBasicAuthManager); - } - - if (this.authManagers.containsKey("phoneNumberLookup")) { - this.phoneNumberLookupBasicAuthManager = - (PhoneNumberLookupBasicAuthManager) this.authManagers.get("phoneNumberLookup"); - } - - if (!this.authManagers.containsKey("phoneNumberLookup") - || !getPhoneNumberLookupBasicAuthCredentials().equals( - phoneNumberLookupBasicAuthUserName, phoneNumberLookupBasicAuthPassword)) { - this.phoneNumberLookupBasicAuthManager = new PhoneNumberLookupBasicAuthManager( - phoneNumberLookupBasicAuthUserName, phoneNumberLookupBasicAuthPassword); - this.authManagers.put("phoneNumberLookup", phoneNumberLookupBasicAuthManager); - } - - if (this.authManagers.containsKey("voice")) { - this.voiceBasicAuthManager = (VoiceBasicAuthManager) this.authManagers.get("voice"); - } - - if (!this.authManagers.containsKey("voice") - || !getVoiceBasicAuthCredentials().equals(voiceBasicAuthUserName, - voiceBasicAuthPassword)) { - this.voiceBasicAuthManager = new VoiceBasicAuthManager(voiceBasicAuthUserName, - voiceBasicAuthPassword); - this.authManagers.put("voice", voiceBasicAuthManager); - } - - if (this.authManagers.containsKey("webRtc")) { - this.webRtcBasicAuthManager = (WebRtcBasicAuthManager) this.authManagers.get("webRtc"); - } - - if (!this.authManagers.containsKey("webRtc") - || !getWebRtcBasicAuthCredentials().equals(webRtcBasicAuthUserName, - webRtcBasicAuthPassword)) { - this.webRtcBasicAuthManager = new WebRtcBasicAuthManager(webRtcBasicAuthUserName, - webRtcBasicAuthPassword); - this.authManagers.put("webRtc", webRtcBasicAuthManager); - } - - - messagingClient = new MessagingClient(this, httpCallback); - multiFactorAuthClient = new MultiFactorAuthClient(this, httpCallback); - phoneNumberLookupClient = new PhoneNumberLookupClient(this, httpCallback); - voiceClient = new VoiceClient(this, httpCallback); - webRtcClient = new WebRtcClient(this, httpCallback); - } - - /** - * Shutdown the underlying HttpClient instance. - */ - public static void shutdown() { - OkClient.shutdown(); - } - - /** - * Provides access to messagingClient Client. - * @return Returns the MessagingClient instance - */ - public MessagingClient getMessagingClient() { - return messagingClient; - } - - /** - * Provides access to multiFactorAuthClient Client. - * @return Returns the MultiFactorAuthClient instance - */ - public MultiFactorAuthClient getMultiFactorAuthClient() { - return multiFactorAuthClient; - } - - /** - * Provides access to phoneNumberLookupClient Client. - * @return Returns the PhoneNumberLookupClient instance - */ - public PhoneNumberLookupClient getPhoneNumberLookupClient() { - return phoneNumberLookupClient; - } - - /** - * Provides access to voiceClient Client. - * @return Returns the VoiceClient instance - */ - public VoiceClient getVoiceClient() { - return voiceClient; - } - - /** - * Provides access to webRtcClient Client. - * @return Returns the WebRtcClient instance - */ - public WebRtcClient getWebRtcClient() { - return webRtcClient; - } - - /** - * Current API environment. - * @return environment - */ - public Environment getEnvironment() { - return environment; - } - - /** - * baseUrl value. - * @return baseUrl - */ - public String getBaseUrl() { - return baseUrl; - } - - /** - * The HTTP Client instance to use for making HTTP requests. - * @return httpClient - */ - public HttpClient getHttpClient() { - return httpClient; - } - - /** - * Http Client Configuration instance. - * @return httpClientConfig - */ - public ReadonlyHttpClientConfiguration getHttpClientConfig() { - return httpClientConfig; - } - - /** - * The credentials to use with MessagingBasicAuth. - * @return messagingBasicAuthCredentials - */ - public MessagingBasicAuthCredentials getMessagingBasicAuthCredentials() { - return messagingBasicAuthManager; - } - - /** - * The credentials to use with MultiFactorAuthBasicAuth. - * @return multiFactorAuthBasicAuthCredentials - */ - public MultiFactorAuthBasicAuthCredentials getMultiFactorAuthBasicAuthCredentials() { - return multiFactorAuthBasicAuthManager; - } - - /** - * The credentials to use with PhoneNumberLookupBasicAuth. - * @return phoneNumberLookupBasicAuthCredentials - */ - public PhoneNumberLookupBasicAuthCredentials getPhoneNumberLookupBasicAuthCredentials() { - return phoneNumberLookupBasicAuthManager; - } - - /** - * The credentials to use with VoiceBasicAuth. - * @return voiceBasicAuthCredentials - */ - public VoiceBasicAuthCredentials getVoiceBasicAuthCredentials() { - return voiceBasicAuthManager; - } - - /** - * The credentials to use with WebRtcBasicAuth. - * @return webRtcBasicAuthCredentials - */ - public WebRtcBasicAuthCredentials getWebRtcBasicAuthCredentials() { - return webRtcBasicAuthManager; - } - - /** - * The list of auth managers. - * @return authManagers - */ - public Map getAuthManagers() { - return authManagers; - } - - /** - * The timeout to use for making HTTP requests. - * @deprecated This method will be removed in a future version. Use - * {@link #getHttpClientConfig()} instead. - * - * @return timeout - */ - @Deprecated - public long timeout() { - return httpClientConfig.getTimeout(); - } - - /** - * Get base URI by current environment. - * @param server Server for which to get the base URI - * @return Processed base URI - */ - public String getBaseUri(Server server) { - Map> parameters = new HashMap<>(); - parameters.put("base_url", - new SimpleEntry(this.baseUrl, false)); - StringBuilder baseUrl = new StringBuilder(environmentMapper(environment, server)); - ApiHelper.appendUrlWithTemplateParameters(baseUrl, parameters); - return baseUrl.toString(); - } - - /** - * Get base URI by current environment. - * @return Processed base URI - */ - public String getBaseUri() { - return getBaseUri(Server.ENUM_DEFAULT); - } - - /** - * Base URLs by environment and server aliases. - * @param environment Environment for which to get the base URI - * @param server Server for which to get the base URI - * @return base URL - */ - private static String environmentMapper(Environment environment, Server server) { - if (environment.equals(Environment.PRODUCTION)) { - if (server.equals(Server.ENUM_DEFAULT)) { - return "api.bandwidth.com"; - } - if (server.equals(Server.MESSAGINGDEFAULT)) { - return "https://messaging.bandwidth.com/api/v2"; - } - if (server.equals(Server.MULTIFACTORAUTHDEFAULT)) { - return "https://mfa.bandwidth.com/api/v1"; - } - if (server.equals(Server.PHONENUMBERLOOKUPDEFAULT)) { - return "https://numbers.bandwidth.com/api/v1"; - } - if (server.equals(Server.VOICEDEFAULT)) { - return "https://voice.bandwidth.com"; - } - if (server.equals(Server.WEBRTCDEFAULT)) { - return "https://api.webrtc.bandwidth.com/v1"; - } - } - if (environment.equals(Environment.CUSTOM)) { - if (server.equals(Server.ENUM_DEFAULT)) { - return "{base_url}"; - } - if (server.equals(Server.MESSAGINGDEFAULT)) { - return "{base_url}"; - } - if (server.equals(Server.MULTIFACTORAUTHDEFAULT)) { - return "{base_url}"; - } - if (server.equals(Server.PHONENUMBERLOOKUPDEFAULT)) { - return "{base_url}"; - } - if (server.equals(Server.VOICEDEFAULT)) { - return "{base_url}"; - } - if (server.equals(Server.WEBRTCDEFAULT)) { - return "{base_url}"; - } - } - return "api.bandwidth.com"; - } - - /** - * Converts this BandwidthClient into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "BandwidthClient [" + "environment=" + environment + ", baseUrl=" + baseUrl - + ", httpClientConfig=" + httpClientConfig + ", authManagers=" + authManagers + "]"; - } - - /** - * Builds a new {@link BandwidthClient.Builder} object. - * Creates the instance with the state of the current client. - * @return a new {@link BandwidthClient.Builder} object - */ - public Builder newBuilder() { - Builder builder = new Builder(); - builder.environment = getEnvironment(); - builder.baseUrl = getBaseUrl(); - builder.httpClient = getHttpClient(); - builder.messagingBasicAuthUserName = - getMessagingBasicAuthCredentials().getBasicAuthUserName(); - builder.messagingBasicAuthPassword = - getMessagingBasicAuthCredentials().getBasicAuthPassword(); - builder.multiFactorAuthBasicAuthUserName = - getMultiFactorAuthBasicAuthCredentials().getBasicAuthUserName(); - builder.multiFactorAuthBasicAuthPassword = - getMultiFactorAuthBasicAuthCredentials().getBasicAuthPassword(); - builder.phoneNumberLookupBasicAuthUserName = - getPhoneNumberLookupBasicAuthCredentials().getBasicAuthUserName(); - builder.phoneNumberLookupBasicAuthPassword = - getPhoneNumberLookupBasicAuthCredentials().getBasicAuthPassword(); - builder.voiceBasicAuthUserName = getVoiceBasicAuthCredentials().getBasicAuthUserName(); - builder.voiceBasicAuthPassword = getVoiceBasicAuthCredentials().getBasicAuthPassword(); - builder.webRtcBasicAuthUserName = getWebRtcBasicAuthCredentials().getBasicAuthUserName(); - builder.webRtcBasicAuthPassword = getWebRtcBasicAuthCredentials().getBasicAuthPassword(); - builder.authManagers = authManagers; - builder.httpCallback = httpCallback; - builder.httpClientConfig(configBldr -> configBldr = - ((HttpClientConfiguration) httpClientConfig).newBuilder()); - return builder; - } - - /** - * Class to build instances of {@link BandwidthClient}. - */ - public static class Builder { - - private Environment environment = Environment.PRODUCTION; - private String baseUrl = "https://www.example.com"; - private HttpClient httpClient; - private String messagingBasicAuthUserName = "TODO: Replace"; - private String messagingBasicAuthPassword = "TODO: Replace"; - private String multiFactorAuthBasicAuthUserName = "TODO: Replace"; - private String multiFactorAuthBasicAuthPassword = "TODO: Replace"; - private String phoneNumberLookupBasicAuthUserName = "TODO: Replace"; - private String phoneNumberLookupBasicAuthPassword = "TODO: Replace"; - private String voiceBasicAuthUserName = "TODO: Replace"; - private String voiceBasicAuthPassword = "TODO: Replace"; - private String webRtcBasicAuthUserName = "TODO: Replace"; - private String webRtcBasicAuthPassword = "TODO: Replace"; - private Map authManagers = null; - private HttpCallback httpCallback = null; - private HttpClientConfiguration.Builder httpClientConfigBuilder = - new HttpClientConfiguration.Builder(); - - - /** - * Credentials setter for MessagingBasicAuth. - * @param basicAuthUserName String value for messagingBasicAuthUserName. - * @param basicAuthPassword String value for messagingBasicAuthPassword. - * @return Builder - */ - public Builder messagingBasicAuthCredentials(String basicAuthUserName, - String basicAuthPassword) { - if (basicAuthUserName == null) { - throw new NullPointerException("BasicAuthUserName cannot be null."); - } - if (basicAuthPassword == null) { - throw new NullPointerException("BasicAuthPassword cannot be null."); - } - this.messagingBasicAuthUserName = basicAuthUserName; - this.messagingBasicAuthPassword = basicAuthPassword; - return this; - } - - /** - * Credentials setter for MultiFactorAuthBasicAuth. - * @param basicAuthUserName String value for multiFactorAuthBasicAuthUserName. - * @param basicAuthPassword String value for multiFactorAuthBasicAuthPassword. - * @return Builder - */ - public Builder multiFactorAuthBasicAuthCredentials(String basicAuthUserName, - String basicAuthPassword) { - if (basicAuthUserName == null) { - throw new NullPointerException("BasicAuthUserName cannot be null."); - } - if (basicAuthPassword == null) { - throw new NullPointerException("BasicAuthPassword cannot be null."); - } - this.multiFactorAuthBasicAuthUserName = basicAuthUserName; - this.multiFactorAuthBasicAuthPassword = basicAuthPassword; - return this; - } - - /** - * Credentials setter for PhoneNumberLookupBasicAuth. - * @param basicAuthUserName String value for phoneNumberLookupBasicAuthUserName. - * @param basicAuthPassword String value for phoneNumberLookupBasicAuthPassword. - * @return Builder - */ - public Builder phoneNumberLookupBasicAuthCredentials(String basicAuthUserName, - String basicAuthPassword) { - if (basicAuthUserName == null) { - throw new NullPointerException("BasicAuthUserName cannot be null."); - } - if (basicAuthPassword == null) { - throw new NullPointerException("BasicAuthPassword cannot be null."); - } - this.phoneNumberLookupBasicAuthUserName = basicAuthUserName; - this.phoneNumberLookupBasicAuthPassword = basicAuthPassword; - return this; - } - - /** - * Credentials setter for VoiceBasicAuth. - * @param basicAuthUserName String value for voiceBasicAuthUserName. - * @param basicAuthPassword String value for voiceBasicAuthPassword. - * @return Builder - */ - public Builder voiceBasicAuthCredentials(String basicAuthUserName, - String basicAuthPassword) { - if (basicAuthUserName == null) { - throw new NullPointerException("BasicAuthUserName cannot be null."); - } - if (basicAuthPassword == null) { - throw new NullPointerException("BasicAuthPassword cannot be null."); - } - this.voiceBasicAuthUserName = basicAuthUserName; - this.voiceBasicAuthPassword = basicAuthPassword; - return this; - } - - /** - * Credentials setter for WebRtcBasicAuth. - * @param basicAuthUserName String value for webRtcBasicAuthUserName. - * @param basicAuthPassword String value for webRtcBasicAuthPassword. - * @return Builder - */ - public Builder webRtcBasicAuthCredentials(String basicAuthUserName, - String basicAuthPassword) { - if (basicAuthUserName == null) { - throw new NullPointerException("BasicAuthUserName cannot be null."); - } - if (basicAuthPassword == null) { - throw new NullPointerException("BasicAuthPassword cannot be null."); - } - this.webRtcBasicAuthUserName = basicAuthUserName; - this.webRtcBasicAuthPassword = basicAuthPassword; - return this; - } - - /** - * Current API environment. - * @param environment The environment for client. - * @return Builder - */ - public Builder environment(Environment environment) { - this.environment = environment; - return this; - } - - /** - * baseUrl value. - * @param baseUrl The baseUrl for client. - * @return Builder - */ - public Builder baseUrl(String baseUrl) { - this.baseUrl = baseUrl; - return this; - } - - /** - * The timeout to use for making HTTP requests. - * @deprecated This method will be removed in a future version. Use - * {@link #httpClientConfig(Consumer) httpClientConfig} instead. - * @param timeout must be greater then 0. - * @return Builder - */ - @Deprecated - public Builder timeout(long timeout) { - this.httpClientConfigBuilder.timeout(timeout); - return this; - } - - /** - * HttpCallback. - * @param httpCallback Callback to be called before and after the HTTP call. - * @return Builder - */ - public Builder httpCallback(HttpCallback httpCallback) { - this.httpCallback = httpCallback; - return this; - } - - /** - * Setter for the Builder of httpClientConfiguration, takes in an operation to be performed - * on the builder instance of HTTP client configuration. - * - * @param action Consumer for the builder of httpClientConfiguration. - * @return Builder - */ - public Builder httpClientConfig(Consumer action) { - action.accept(httpClientConfigBuilder); - return this; - } - - /** - * Builds a new BandwidthClient object using the set fields. - * @return BandwidthClient - */ - public BandwidthClient build() { - HttpClientConfiguration httpClientConfig = httpClientConfigBuilder.build(); - httpClient = new OkClient(httpClientConfig); - - return new BandwidthClient(environment, baseUrl, httpClient, httpClientConfig, - messagingBasicAuthUserName, messagingBasicAuthPassword, - multiFactorAuthBasicAuthUserName, multiFactorAuthBasicAuthPassword, - phoneNumberLookupBasicAuthUserName, phoneNumberLookupBasicAuthPassword, - voiceBasicAuthUserName, voiceBasicAuthPassword, webRtcBasicAuthUserName, - webRtcBasicAuthPassword, authManagers, httpCallback); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/Configuration.java b/src/main/java/com/bandwidth/Configuration.java deleted file mode 100644 index bba5e06a..00000000 --- a/src/main/java/com/bandwidth/Configuration.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.ReadonlyHttpClientConfiguration; - -/** - * Configuration Interface for the library. - */ -public interface Configuration { - - /** - * Current API environment. - * @return a copy of environment - */ - Environment getEnvironment(); - - /** - * baseUrl value. - * @return a copy of baseUrl - */ - String getBaseUrl(); - - /** - * Http Client Configuration instance. - * See available [builder methods here](__HttpClientConfiguration.Builder). - * @return a copy of httpClientConfig - */ - ReadonlyHttpClientConfiguration getHttpClientConfig(); - - /** - * The timeout to use for making HTTP requests. The timeout to use for making HTTP requests. - * @return a copy of timeout - */ - long timeout(); - - /** - * The credentials to use with MessagingBasicAuth. - * @return messagingBasicAuthCredentials - */ - MessagingBasicAuthCredentials getMessagingBasicAuthCredentials(); - - /** - * The credentials to use with MultiFactorAuthBasicAuth. - * @return multiFactorAuthBasicAuthCredentials - */ - MultiFactorAuthBasicAuthCredentials getMultiFactorAuthBasicAuthCredentials(); - - /** - * The credentials to use with PhoneNumberLookupBasicAuth. - * @return phoneNumberLookupBasicAuthCredentials - */ - PhoneNumberLookupBasicAuthCredentials getPhoneNumberLookupBasicAuthCredentials(); - - /** - * The credentials to use with VoiceBasicAuth. - * @return voiceBasicAuthCredentials - */ - VoiceBasicAuthCredentials getVoiceBasicAuthCredentials(); - - /** - * The credentials to use with WebRtcBasicAuth. - * @return webRtcBasicAuthCredentials - */ - WebRtcBasicAuthCredentials getWebRtcBasicAuthCredentials(); - - /** - * Get base URI by current environment. - * @param server Server for which to get the base URI - * @return Processed base URI - */ - String getBaseUri(Server server); - - /** - * Get base URI by current environment. - * @return Processed base URI - */ - String getBaseUri(); -} diff --git a/src/main/java/com/bandwidth/DateTimeHelper.java b/src/main/java/com/bandwidth/DateTimeHelper.java deleted file mode 100644 index 7c2e1e25..00000000 --- a/src/main/java/com/bandwidth/DateTimeHelper.java +++ /dev/null @@ -1,394 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import java.io.IOException; -import java.time.Instant; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * This is a utility class for DateTime operations. - */ -public class DateTimeHelper { - /** - * Match the pattern for a datetime string in Rfc1123 format. - */ - private static final DateTimeFormatter RFC1123_DATE_TIME_FORMATTER = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z"); - - /** - * Parse a Unix Timestamp to a DateTime object. - * @param date The Unix Timestamp - * @return The DateTime object - */ - public static LocalDateTime fromUnixTimestamp(Long date) { - return LocalDateTime.ofInstant(Instant.ofEpochSecond(date), ZoneId.systemDefault()); - } - - /** - * Parse a Unix Timestamp string to a DateTime object. - * @param date The Unix Timestamp as a String - * @return The parsed DateTime object - */ - public static LocalDateTime fromUnixTimestamp(String date) { - return LocalDateTime.ofInstant(Instant.ofEpochSecond(Long.parseLong(date)), - ZoneId.systemDefault()); - } - - /** - * Convert a DateTime object to a Unix Timestamp string. - * @param value The DateTime object to convert - * @return The converted String - */ - public static String toUnixTimestamp(LocalDateTime value) { - return value == null ? null : Long.toString(value.toEpochSecond(java.time.ZoneOffset.UTC)); - } - - /** - * Convert a List of DateTime objects to Unix Timestamp strings. - * @param values The List of DateTime objects to convert - * @return The list of converted Strings - */ - public static List toUnixTimestamp(List values) { - if (values == null) { - return null; - } - List valuesAsString = new ArrayList<>(); - for (LocalDateTime value: values) { - valuesAsString.add(toUnixTimestamp(value)); - } - return valuesAsString; - } - - /** - * Convert a Map of DateTime objects to Unix Timestamp strings. - * @param values The Map of DateTime objects to convert - * @return The Map of converted Strings - */ - public static Map toUnixTimestamp(Map values) { - if (values == null) { - return null; - } - Map valuesAsString = new HashMap<>(); - for (Map.Entry value: values.entrySet()) { - valuesAsString.put(value.getKey(), toUnixTimestamp(value.getValue())); - } - return valuesAsString; - } - - /** - * Convert a DateTime object to a Unix Timestamp Long. - * @param value The DateTime object to convert - * @return The converted Long - */ - public static Long toUnixTimestampLong(LocalDateTime value) { - return value == null ? null : value.toEpochSecond(java.time.ZoneOffset.UTC); - } - - /** - * Convert a List of DateTime objects to Unix Timestamp Longs. - * @param values The List of DateTime objects to convert - * @return The list of converted Longs. - */ - public static List toUnixTimestampLong(List values) { - if (values == null) { - return null; - } - List valuesAsLong = new ArrayList<>(); - for (LocalDateTime value : values) { - valuesAsLong.add(toUnixTimestampLong(value)); - } - return valuesAsLong; - } - - /** - * Convert a Map of DateTime objects to Unix Timestamp Longs. - * @param values The Map of DateTime objects to convert - * @return The Map of converted Longs. - */ - public static Map toUnixTimestampLong(Map values) { - if (values == null) { - return null; - } - Map valuesAsLong = new HashMap<>(); - for (Map.Entry value: values.entrySet()) { - valuesAsLong.put(value.getKey(), toUnixTimestampLong(value.getValue())); - } - return valuesAsLong; - } - - /** - * Parse a datetime string in Rfc1123 format to a DateTime object. - * @param date The datetime string in Rfc1123 format - * @return The parsed DateTime object - */ - public static LocalDateTime fromRfc1123DateTime(String date) { - return LocalDateTime.parse(date, RFC1123_DATE_TIME_FORMATTER); - } - - /** - * Convert a DateTime object to a Rfc1123 formatted string. - * @param value The DateTime object to convert - * @return The converted String - */ - public static String toRfc1123DateTime(LocalDateTime value) { - return value == null ? null - : RFC1123_DATE_TIME_FORMATTER.format(value.atZone(ZoneId.of("GMT"))); - } - - /** - * Convert a List of DateTime objects to Rfc1123 formatted strings. - * @param values The List of DateTime objects to convert - * @return The List of converted Strings - */ - public static List toRfc1123DateTime(List values) { - if (values == null) { - return null; - } - List valuesAsString = new ArrayList<>(); - for (LocalDateTime value: values) { - valuesAsString.add(toRfc1123DateTime(value)); - } - return valuesAsString; - } - - /** - * Convert a Map of DateTime objects to Rfc1123 formatted strings. - * @param values The Map of DateTime objects to convert - * @return The Map of converted Strings - */ - public static Map toRfc1123DateTime(Map values) { - if (values == null) { - return null; - } - Map valuesAsString = new HashMap<>(); - for (Map.Entry value: values.entrySet()) { - valuesAsString.put(value.getKey(), toRfc1123DateTime(value.getValue())); - } - return valuesAsString; - } - - /** - * Parse a datetime string in Rfc8601(Rfc3339) format to a DateTime object. - * @param date The datetime string in Rfc8601(Rfc3339) format - * @return The parsed DateTime object - */ - public static LocalDateTime fromRfc8601DateTime(String date) { - Pattern pattern = Pattern.compile("(Z|([+-])(\\d{2}:\\d{2}))$"); - Matcher patternMatcher = pattern.matcher(date); - if (patternMatcher.find()) { - OffsetDateTime parsed = OffsetDateTime.parse(date, DateTimeFormatter.ISO_DATE_TIME); - return LocalDateTime.from(parsed.withOffsetSameInstant(ZoneOffset.UTC)); - } - return LocalDateTime.parse(date, DateTimeFormatter.ISO_DATE_TIME); - } - - /** - * Convert a DateTime object to a Rfc8601(Rfc3339) formatted string. - * @param value The DateTime object to convert - * @return The converted String - */ - public static String toRfc8601DateTime(LocalDateTime value) { - return value == null ? null : value.toString() + "Z"; - } - - /** - * Convert a List of DateTime objects to Rfc8601(Rfc3339) formatted strings. - * @param values The List of DateTime objects to convert - * @return The List of converted Strings - */ - public static List toRfc8601DateTime(List values) { - if (values == null) { - return null; - } - List valuesAsString = new ArrayList<>(); - for (LocalDateTime value: values) { - valuesAsString.add(toRfc8601DateTime(value)); - } - return valuesAsString; - } - - /** - * Convert a Map of DateTime objects to Rfc8601(Rfc3339) formatted strings. - * @param values The Map of DateTime objects to convert - * @return The Map of converted Strings - */ - public static Map toRfc8601DateTime(Map values) { - if (values == null) { - return null; - } - Map valuesAsString = new HashMap<>(); - for (Map.Entry value: values.entrySet()) { - valuesAsString.put(value.getKey(), toRfc8601DateTime(value.getValue())); - } - return valuesAsString; - } - - /** - * Parse a simple date string to a LocalDate object. - * @param date The date string - * @return The parsed LocalDate object - */ - public static LocalDate fromSimpleDate(String date) { - return LocalDate.parse(date); - } - - /** - * Convert a LocalDate object to a string. - * @param value The LocalDate object to convert - * @return The converted Strings - */ - public static String toSimpleDate(LocalDate value) { - return value == null ? null : value.toString(); - } - - /** - * Convert a List of LocalDate objects to strings. - * @param values The List of LocalDate objects to convert - * @return The List of converted Strings - */ - public static List toSimpleDate(List values) { - if (values == null) { - return null; - } - List valuesAsString = new ArrayList<>(); - for (LocalDate value: values) { - valuesAsString.add(toSimpleDate(value)); - } - return valuesAsString; - } - - /** - * Convert a Map of LocalDate objects to strings. - * @param values The Map of LocalDate objects to convert - * @return The Map of converted Strings - */ - public static Map toSimpleDate(Map values) { - if (values == null) { - return null; - } - Map valuesAsString = new HashMap<>(); - for (Map.Entry value: values.entrySet()) { - valuesAsString.put(value.getKey(), toSimpleDate(value.getValue())); - } - return valuesAsString; - } - - /** - * A class to handle deserialization of DateTime objects to Unix Timestamps. - */ - public static class UnixTimestampDeserializer extends JsonDeserializer { - @SuppressWarnings("unused") - @Override - public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - return fromUnixTimestamp(jp.getValueAsString()); - } - } - - /** - * A class to handle serialization of Unix Timestamps to DateTime objects. - */ - public static class UnixTimestampSerializer extends JsonSerializer { - @SuppressWarnings("unused") - @Override - public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeObject(toUnixTimestampLong(value)); - } - } - - /** - * A class to handle deserialization of DateTime objects to Rfc1123 format strings. - */ - public static class Rfc1123DateTimeDeserializer extends JsonDeserializer { - @SuppressWarnings("unused") - @Override - public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - return fromRfc1123DateTime(jp.getValueAsString()); - } - } - - /** - * A class to handle serialization of Rfc1123 format strings to DateTime objects. - */ - public static class Rfc1123DateTimeSerializer extends JsonSerializer { - @SuppressWarnings("unused") - @Override - public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeString(toRfc1123DateTime(value)); - } - } - - /** - * A class to handle deserialization of DateTime objects to Rfc8601(Rfc3339) format strings. - */ - public static class Rfc8601DateTimeDeserializer extends JsonDeserializer { - @SuppressWarnings("unused") - @Override - public LocalDateTime deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - return fromRfc8601DateTime(jp.getValueAsString()); - } - } - - /** - * A class to handle serialization of Rfc8601(Rfc3339) format strings to DateTime objects. - */ - public static class Rfc8601DateTimeSerializer extends JsonSerializer { - @SuppressWarnings("unused") - @Override - public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeString(toRfc8601DateTime(value)); - } - } - - /** - * A class to handle deserialization of date strings to LocalDate objects. - */ - public static class SimpleDateDeserializer extends JsonDeserializer { - @SuppressWarnings("unused") - @Override - public LocalDate deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - return fromSimpleDate(jp.getValueAsString()); - } - } - - /** - * A class to handle serialization of LocalDate objects to date strings. - */ - public static class SimpleDateSerializer extends JsonSerializer { - @SuppressWarnings("unused") - @Override - public void serialize(LocalDate value, JsonGenerator jgen, SerializerProvider provider) - throws IOException, JsonProcessingException { - jgen.writeString(toSimpleDate(value)); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/Environment.java b/src/main/java/com/bandwidth/Environment.java deleted file mode 100644 index 7ca3dbb3..00000000 --- a/src/main/java/com/bandwidth/Environment.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * Environment to be used. - */ -public enum Environment { - PRODUCTION, - - CUSTOM; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - PRODUCTION.value = "production"; - CUSTOM.value = "custom"; - - valueMap.put("production", PRODUCTION); - valueMap.put("custom", CUSTOM); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static Environment fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of Environment values to list of string values. - * @param toConvert The list of Environment values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (Environment enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/MessagingBasicAuthCredentials.java b/src/main/java/com/bandwidth/MessagingBasicAuthCredentials.java deleted file mode 100644 index a89f904b..00000000 --- a/src/main/java/com/bandwidth/MessagingBasicAuthCredentials.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -/** - * Interface for defining the behavior of Basic Authentication. - */ -public interface MessagingBasicAuthCredentials { - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - String getBasicAuthUserName(); - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - String getBasicAuthPassword(); - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - boolean equals(String basicAuthUserName, String basicAuthPassword); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/MessagingBasicAuthManager.java b/src/main/java/com/bandwidth/MessagingBasicAuthManager.java deleted file mode 100644 index e7f36a5c..00000000 --- a/src/main/java/com/bandwidth/MessagingBasicAuthManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.request.HttpRequest; -import java.util.Base64; -import java.util.concurrent.CompletableFuture; - -/** - * Utility class for authorization and token management. - */ -public class MessagingBasicAuthManager implements AuthManager, MessagingBasicAuthCredentials { - - private String basicAuthUserName; - - private String basicAuthPassword; - - /** - * Constructor. - * @param username String value for username. - * @param password String value for password. - */ - public MessagingBasicAuthManager(String username, String password) { - this.basicAuthUserName = username; - this.basicAuthPassword = password; - } - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - public String getBasicAuthUserName() { - return basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - public String getBasicAuthPassword() { - return basicAuthPassword; - } - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - public boolean equals(String basicAuthUserName, String basicAuthPassword) { - return basicAuthUserName.equals(getBasicAuthUserName()) - && basicAuthPassword.equals(getBasicAuthPassword()); - } - - /** - * Converts this MessagingBasicAuthManager into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "MessagingBasicAuthManager [" + "basicAuthUserName=" + basicAuthUserName - + ", basicAuthPassword=" + basicAuthPassword + "]"; - } - - /** - * Adds authentication to the given HttpRequest. - */ - public HttpRequest apply(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return httpRequest; - } - - /** - * Asynchronously adds authentication to the given HttpRequest. - */ - public CompletableFuture applyAsync(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return CompletableFuture.completedFuture(httpRequest); - } -} diff --git a/src/main/java/com/bandwidth/MessagingClient.java b/src/main/java/com/bandwidth/MessagingClient.java deleted file mode 100644 index 43e9c513..00000000 --- a/src/main/java/com/bandwidth/MessagingClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.messaging.controllers.*; - -public final class MessagingClient { - private final BandwidthClient config; - - /** - * Private store for controllers. - */ - private APIController client; - - /** - * Default constructor. - */ - public MessagingClient(BandwidthClient config, HttpCallback httpCallback) { - this.config = config; - client = new APIController(config, config.getHttpClient(), config.getAuthManagers(), - httpCallback); - } - - public static void shutdown() { - OkClient.shutdown(); - } - - public APIController getAPIController() { - return client; - } - - public Configuration getConfiguration() { - return config; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthCredentials.java b/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthCredentials.java deleted file mode 100644 index f4add491..00000000 --- a/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthCredentials.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -/** - * Interface for defining the behavior of Basic Authentication. - */ -public interface MultiFactorAuthBasicAuthCredentials { - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - String getBasicAuthUserName(); - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - String getBasicAuthPassword(); - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - boolean equals(String basicAuthUserName, String basicAuthPassword); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthManager.java b/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthManager.java deleted file mode 100644 index 52142c43..00000000 --- a/src/main/java/com/bandwidth/MultiFactorAuthBasicAuthManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.request.HttpRequest; -import java.util.Base64; -import java.util.concurrent.CompletableFuture; - -/** - * Utility class for authorization and token management. - */ -public class MultiFactorAuthBasicAuthManager implements AuthManager, MultiFactorAuthBasicAuthCredentials { - - private String basicAuthUserName; - - private String basicAuthPassword; - - /** - * Constructor. - * @param username String value for username. - * @param password String value for password. - */ - public MultiFactorAuthBasicAuthManager(String username, String password) { - this.basicAuthUserName = username; - this.basicAuthPassword = password; - } - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - public String getBasicAuthUserName() { - return basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - public String getBasicAuthPassword() { - return basicAuthPassword; - } - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - public boolean equals(String basicAuthUserName, String basicAuthPassword) { - return basicAuthUserName.equals(getBasicAuthUserName()) - && basicAuthPassword.equals(getBasicAuthPassword()); - } - - /** - * Converts this MultiFactorAuthBasicAuthManager into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "MultiFactorAuthBasicAuthManager [" + "basicAuthUserName=" + basicAuthUserName - + ", basicAuthPassword=" + basicAuthPassword + "]"; - } - - /** - * Adds authentication to the given HttpRequest. - */ - public HttpRequest apply(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return httpRequest; - } - - /** - * Asynchronously adds authentication to the given HttpRequest. - */ - public CompletableFuture applyAsync(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return CompletableFuture.completedFuture(httpRequest); - } -} diff --git a/src/main/java/com/bandwidth/MultiFactorAuthClient.java b/src/main/java/com/bandwidth/MultiFactorAuthClient.java deleted file mode 100644 index e078475f..00000000 --- a/src/main/java/com/bandwidth/MultiFactorAuthClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.multifactorauth.controllers.*; - -public final class MultiFactorAuthClient { - private final BandwidthClient config; - - /** - * Private store for controllers. - */ - private MFAController mFA; - - /** - * Default constructor. - */ - public MultiFactorAuthClient(BandwidthClient config, HttpCallback httpCallback) { - this.config = config; - mFA = new MFAController(config, config.getHttpClient(), config.getAuthManagers(), - httpCallback); - } - - public static void shutdown() { - OkClient.shutdown(); - } - - public MFAController getMFAController() { - return mFA; - } - - public Configuration getConfiguration() { - return config; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthCredentials.java b/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthCredentials.java deleted file mode 100644 index 3894a716..00000000 --- a/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthCredentials.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -/** - * Interface for defining the behavior of Basic Authentication. - */ -public interface PhoneNumberLookupBasicAuthCredentials { - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - String getBasicAuthUserName(); - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - String getBasicAuthPassword(); - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - boolean equals(String basicAuthUserName, String basicAuthPassword); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthManager.java b/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthManager.java deleted file mode 100644 index 2c63d954..00000000 --- a/src/main/java/com/bandwidth/PhoneNumberLookupBasicAuthManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.request.HttpRequest; -import java.util.Base64; -import java.util.concurrent.CompletableFuture; - -/** - * Utility class for authorization and token management. - */ -public class PhoneNumberLookupBasicAuthManager implements AuthManager, PhoneNumberLookupBasicAuthCredentials { - - private String basicAuthUserName; - - private String basicAuthPassword; - - /** - * Constructor. - * @param username String value for username. - * @param password String value for password. - */ - public PhoneNumberLookupBasicAuthManager(String username, String password) { - this.basicAuthUserName = username; - this.basicAuthPassword = password; - } - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - public String getBasicAuthUserName() { - return basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - public String getBasicAuthPassword() { - return basicAuthPassword; - } - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - public boolean equals(String basicAuthUserName, String basicAuthPassword) { - return basicAuthUserName.equals(getBasicAuthUserName()) - && basicAuthPassword.equals(getBasicAuthPassword()); - } - - /** - * Converts this PhoneNumberLookupBasicAuthManager into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "PhoneNumberLookupBasicAuthManager [" + "basicAuthUserName=" + basicAuthUserName - + ", basicAuthPassword=" + basicAuthPassword + "]"; - } - - /** - * Adds authentication to the given HttpRequest. - */ - public HttpRequest apply(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return httpRequest; - } - - /** - * Asynchronously adds authentication to the given HttpRequest. - */ - public CompletableFuture applyAsync(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return CompletableFuture.completedFuture(httpRequest); - } -} diff --git a/src/main/java/com/bandwidth/PhoneNumberLookupClient.java b/src/main/java/com/bandwidth/PhoneNumberLookupClient.java deleted file mode 100644 index 860571de..00000000 --- a/src/main/java/com/bandwidth/PhoneNumberLookupClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.phonenumberlookup.controllers.*; - -public final class PhoneNumberLookupClient { - private final BandwidthClient config; - - /** - * Private store for controllers. - */ - private APIController client; - - /** - * Default constructor. - */ - public PhoneNumberLookupClient(BandwidthClient config, HttpCallback httpCallback) { - this.config = config; - client = new APIController(config, config.getHttpClient(), config.getAuthManagers(), - httpCallback); - } - - public static void shutdown() { - OkClient.shutdown(); - } - - public APIController getAPIController() { - return client; - } - - public Configuration getConfiguration() { - return config; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/Server.java b/src/main/java/com/bandwidth/Server.java deleted file mode 100644 index abfef44a..00000000 --- a/src/main/java/com/bandwidth/Server.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * Server to be used. - */ -public enum Server { - ENUM_DEFAULT, - - MESSAGINGDEFAULT, - - MULTIFACTORAUTHDEFAULT, - - PHONENUMBERLOOKUPDEFAULT, - - VOICEDEFAULT, - - WEBRTCDEFAULT; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - ENUM_DEFAULT.value = "default"; - MESSAGINGDEFAULT.value = "MessagingDefault"; - MULTIFACTORAUTHDEFAULT.value = "MultiFactorAuthDefault"; - PHONENUMBERLOOKUPDEFAULT.value = "PhoneNumberLookupDefault"; - VOICEDEFAULT.value = "VoiceDefault"; - WEBRTCDEFAULT.value = "WebRtcDefault"; - - valueMap.put("default", ENUM_DEFAULT); - valueMap.put("MessagingDefault", MESSAGINGDEFAULT); - valueMap.put("MultiFactorAuthDefault", MULTIFACTORAUTHDEFAULT); - valueMap.put("PhoneNumberLookupDefault", PHONENUMBERLOOKUPDEFAULT); - valueMap.put("VoiceDefault", VOICEDEFAULT); - valueMap.put("WebRtcDefault", WEBRTCDEFAULT); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static Server fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of Server values to list of string values. - * @param toConvert The list of Server values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (Server enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/VoiceBasicAuthCredentials.java b/src/main/java/com/bandwidth/VoiceBasicAuthCredentials.java deleted file mode 100644 index 0d1755db..00000000 --- a/src/main/java/com/bandwidth/VoiceBasicAuthCredentials.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -/** - * Interface for defining the behavior of Basic Authentication. - */ -public interface VoiceBasicAuthCredentials { - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - String getBasicAuthUserName(); - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - String getBasicAuthPassword(); - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - boolean equals(String basicAuthUserName, String basicAuthPassword); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/VoiceBasicAuthManager.java b/src/main/java/com/bandwidth/VoiceBasicAuthManager.java deleted file mode 100644 index 1f9f77c4..00000000 --- a/src/main/java/com/bandwidth/VoiceBasicAuthManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.request.HttpRequest; -import java.util.Base64; -import java.util.concurrent.CompletableFuture; - -/** - * Utility class for authorization and token management. - */ -public class VoiceBasicAuthManager implements AuthManager, VoiceBasicAuthCredentials { - - private String basicAuthUserName; - - private String basicAuthPassword; - - /** - * Constructor. - * @param username String value for username. - * @param password String value for password. - */ - public VoiceBasicAuthManager(String username, String password) { - this.basicAuthUserName = username; - this.basicAuthPassword = password; - } - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - public String getBasicAuthUserName() { - return basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - public String getBasicAuthPassword() { - return basicAuthPassword; - } - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - public boolean equals(String basicAuthUserName, String basicAuthPassword) { - return basicAuthUserName.equals(getBasicAuthUserName()) - && basicAuthPassword.equals(getBasicAuthPassword()); - } - - /** - * Converts this VoiceBasicAuthManager into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "VoiceBasicAuthManager [" + "basicAuthUserName=" + basicAuthUserName - + ", basicAuthPassword=" + basicAuthPassword + "]"; - } - - /** - * Adds authentication to the given HttpRequest. - */ - public HttpRequest apply(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return httpRequest; - } - - /** - * Asynchronously adds authentication to the given HttpRequest. - */ - public CompletableFuture applyAsync(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return CompletableFuture.completedFuture(httpRequest); - } -} diff --git a/src/main/java/com/bandwidth/VoiceClient.java b/src/main/java/com/bandwidth/VoiceClient.java deleted file mode 100644 index 663c30e3..00000000 --- a/src/main/java/com/bandwidth/VoiceClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.voice.controllers.*; - -public final class VoiceClient { - private final BandwidthClient config; - - /** - * Private store for controllers. - */ - private APIController client; - - /** - * Default constructor. - */ - public VoiceClient(BandwidthClient config, HttpCallback httpCallback) { - this.config = config; - client = new APIController(config, config.getHttpClient(), config.getAuthManagers(), - httpCallback); - } - - public static void shutdown() { - OkClient.shutdown(); - } - - public APIController getAPIController() { - return client; - } - - public Configuration getConfiguration() { - return config; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/WebRtcBasicAuthCredentials.java b/src/main/java/com/bandwidth/WebRtcBasicAuthCredentials.java deleted file mode 100644 index a673d435..00000000 --- a/src/main/java/com/bandwidth/WebRtcBasicAuthCredentials.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -/** - * Interface for defining the behavior of Basic Authentication. - */ -public interface WebRtcBasicAuthCredentials { - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - String getBasicAuthUserName(); - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - String getBasicAuthPassword(); - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - boolean equals(String basicAuthUserName, String basicAuthPassword); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/WebRtcBasicAuthManager.java b/src/main/java/com/bandwidth/WebRtcBasicAuthManager.java deleted file mode 100644 index c59f5e5d..00000000 --- a/src/main/java/com/bandwidth/WebRtcBasicAuthManager.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.request.HttpRequest; -import java.util.Base64; -import java.util.concurrent.CompletableFuture; - -/** - * Utility class for authorization and token management. - */ -public class WebRtcBasicAuthManager implements AuthManager, WebRtcBasicAuthCredentials { - - private String basicAuthUserName; - - private String basicAuthPassword; - - /** - * Constructor. - * @param username String value for username. - * @param password String value for password. - */ - public WebRtcBasicAuthManager(String username, String password) { - this.basicAuthUserName = username; - this.basicAuthPassword = password; - } - - /** - * String value for basicAuthUserName. - * @return basicAuthUserName - */ - public String getBasicAuthUserName() { - return basicAuthUserName; - } - - /** - * String value for basicAuthPassword. - * @return basicAuthPassword - */ - public String getBasicAuthPassword() { - return basicAuthPassword; - } - - /** - * Checks if provided credentials matched with existing ones. - * @param basicAuthUserName String value for credentials. - * @param basicAuthPassword String value for credentials. - * @return true if credentials matched. - */ - public boolean equals(String basicAuthUserName, String basicAuthPassword) { - return basicAuthUserName.equals(getBasicAuthUserName()) - && basicAuthPassword.equals(getBasicAuthPassword()); - } - - /** - * Converts this WebRtcBasicAuthManager into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "WebRtcBasicAuthManager [" + "basicAuthUserName=" + basicAuthUserName - + ", basicAuthPassword=" + basicAuthPassword + "]"; - } - - /** - * Adds authentication to the given HttpRequest. - */ - public HttpRequest apply(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return httpRequest; - } - - /** - * Asynchronously adds authentication to the given HttpRequest. - */ - public CompletableFuture applyAsync(HttpRequest httpRequest) { - String authCredentials = basicAuthUserName + ":" + basicAuthPassword; - httpRequest.getHeaders().add("Authorization", "Basic " + Base64.getEncoder().encodeToString(authCredentials.getBytes())); - return CompletableFuture.completedFuture(httpRequest); - } -} diff --git a/src/main/java/com/bandwidth/WebRtcClient.java b/src/main/java/com/bandwidth/WebRtcClient.java deleted file mode 100644 index 6602dc3f..00000000 --- a/src/main/java/com/bandwidth/WebRtcClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth; - -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.OkClient; -import com.bandwidth.webrtc.controllers.*; - -public final class WebRtcClient { - private final BandwidthClient config; - - /** - * Private store for controllers. - */ - private APIController client; - - /** - * Default constructor. - */ - public WebRtcClient(BandwidthClient config, HttpCallback httpCallback) { - this.config = config; - client = new APIController(config, config.getHttpClient(), config.getAuthManagers(), - httpCallback); - } - - public static void shutdown() { - OkClient.shutdown(); - } - - public APIController getAPIController() { - return client; - } - - public Configuration getConfiguration() { - return config; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/controllers/BaseController.java b/src/main/java/com/bandwidth/controllers/BaseController.java deleted file mode 100644 index 21a7700f..00000000 --- a/src/main/java/com/bandwidth/controllers/BaseController.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.controllers; - -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; - -/** - * Base class for all Controllers. - */ -public abstract class BaseController { - protected static final String userAgent = "java-sdk"; - - /** - * Protected variables to hold an instance of Configuration. - */ - protected final Configuration config; - - /** - * Protected variable to hold an instance of HttpCallback if the user provides it. - */ - protected final HttpCallback httpCallback; - - protected Map authManagers; - - private HttpClient httpClient; - - protected BaseController(Configuration config, HttpClient httpClient, - Map authManagers) { - this(config, httpClient, authManagers, null); - } - - protected BaseController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - this.config = config; - this.httpClient = httpClient; - this.authManagers = authManagers; - this.httpCallback = httpCallback; - } - - /** - * Get httpCallback associated with this controller. - * @return HttpCallback - */ - public HttpCallback getHttpCallback() { - return httpCallback; - } - - /** - * Shared instance of the Http client. - * @return The shared instance of the http client - */ - public HttpClient getClientInstance() { - return httpClient; - } - - /** - * Validates the response against HTTP errors defined at the API level. - * @param response The response recieved - * @param context Context of the request and the recieved response - * @throws ApiException Represents error response from the server. - */ - protected void validateResponse(HttpResponse response, HttpContext context) - throws ApiException { - //get response status code to validate - int responseCode = response.getStatusCode(); - if ((responseCode < 200) || (responseCode > 208)) { //[200,208] = HTTP OK - throw new ApiException("HTTP Response Not OK", context); - } - - } - - /** - * RequestSupplier. - */ - protected interface RequestSupplier { - - /** - * Supplies the HttpRequest object. - * @return An object of type HttpRequest - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - HttpRequest supply() throws ApiException, IOException; - } - - /** - * RequestExecutor. - */ - protected interface RequestExecutor { - - /** - * Execute a given HttpRequest to get the response back. - * @param request The given HttpRequest to execute - * @return CompletableFuture of HttpResponse after execution - */ - CompletableFuture execute(HttpRequest request); - } - - /** - * ResponseHandler. - */ - protected interface ResponseHandler { - - /** - * Handles the response for an endpoint. - * @param context HttpContext of the request and the received response - * @return An object of type T wrapped in ApiResponse. - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - ApiResponse handle(HttpContext context) throws ApiException, IOException; - } - - /** - * Make an asynchronous HTTP endpoint call. - * @param The type of the object for response - * @param requestSupplier An object of RequestSupplier to supply an instance of HttpRequest - * @param requestExecutor An object of RequestExecutor to execute the given request - * @param responseHandler An object of ResponseHandler to handle the endpoint response - * @return An object of type CompletableFuture of T - */ - public CompletableFuture> makeHttpCallAsync(RequestSupplier requestSupplier, - RequestExecutor requestExecutor, ResponseHandler responseHandler) { - final HttpRequest request; - try { - request = requestSupplier.supply(); - } catch (Exception e) { - CompletableFuture> futureResponse = new CompletableFuture<>(); - futureResponse.completeExceptionally(e); - return futureResponse; - } - - // Invoke request and get response - return requestExecutor.execute(request).thenApplyAsync(response -> { - HttpContext context = new HttpContext(request, response); - try { - return responseHandler.handle(context); - } catch (Exception e) { - throw new CompletionException(e); - } - }); - } -} diff --git a/src/main/java/com/bandwidth/exceptions/ApiException.java b/src/main/java/com/bandwidth/exceptions/ApiException.java deleted file mode 100644 index 928be292..00000000 --- a/src/main/java/com/bandwidth/exceptions/ApiException.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.exceptions; - -import com.bandwidth.ApiHelper; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.databind.JsonNode; -import java.io.IOException; - -/** - * This is the base class for all exceptions that represent an error response from the server. - */ -public class ApiException extends Exception { - //UID for serialization - private static final long serialVersionUID = 6424174253911720338L; - - //private fields - private HttpContext httpContext; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - */ - public ApiException(String reason) { - super(reason); - } - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public ApiException(String reason, HttpContext context) { - super(reason); - this.httpContext = context; - - //if a derived exception class is used, then perform deserialization of response body - if ((context == null) || (context.getResponse() == null) - || (context.getResponse().getRawBody() == null)) { - return; - } - - try { - // Can throw IOException if input has invalid content type. - JsonNode jsonNode = ApiHelper.mapper.readTree(context.getResponse().getRawBody()); - if (!getClass().equals(ApiException.class)) { - // In case of IOException JsonNode cannot be detected. - ApiHelper.mapper.readerForUpdating(this).readValue(jsonNode); - } - } catch (IOException ioException) { - // Can throw exception while object mapper tries to: - // Deserialize the content as JSON tree. - // Convert results from JSON tree into given value type. - } - } - - /** - * The HTTP response code from the API request. - * @return Returns the response code for ApiException - */ - public int getResponseCode() { - return (httpContext != null) ? httpContext.getResponse().getStatusCode() : -1; - } - - /** - * The HTTP response body from the API request. - * @return Returns the object of HttpContext for ApiException - */ - public HttpContext getHttpContext() { - return httpContext; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/Headers.java b/src/main/java/com/bandwidth/http/Headers.java deleted file mode 100644 index 3714685c..00000000 --- a/src/main/java/com/bandwidth/http/Headers.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -/** - * Class for creating and managing HTTP Headers. - */ -public class Headers { - private Map> headers; - - /** - * Default constructor. - */ - public Headers() { - this.headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - } - - /** - * Constructor that creates a new instance using a given Map. - * @param headers The Map to use for creating an instance of this class. - */ - public Headers(Map> headers) { - this.headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - for (Map.Entry> kv : headers.entrySet()) { - this.headers.put(kv.getKey(), kv.getValue()); - } - } - - /** - * Copy Constructor. - * @param h Headers Instance to be cloned. - */ - public Headers(Headers h) { - this.headers = cloneHeaderMap(h.headers); - } - - /** - * Use to check if the given name is present in headers. - * @param headerName String name for header to be checked. - * @return true if headerName is found, false otherwise. - */ - public boolean has(String headerName) { - return this.headers.containsKey(headerName); - } - - /** - * Returns a Set containing all header names. - * @return A Set containing all header names. - */ - public Set names() { - return headers.keySet(); - } - - /** - * Get the first value associated with a given header name, - * or null if the header name is not found. - * @param headerName The header name to find the associated value for. - * @return The first value associated with the given header name. - */ - public String value(String headerName) { - if (headers.containsKey(headerName)) { - return headers.get(headerName).get(0); - } - return null; - } - - /** - * Get a List of all values associated with a given header name, - * or null if the header name is not found. - * @param headerName The header name to find the associated values for. - * @return A List of values associated with the given header name. - */ - public List values(String headerName) { - if (headers.containsKey(headerName)) { - return headers.get(headerName); - } - return null; - } - - /** - * Returns a Map of the headers, giving only one value for each header name. - * @return A Map of header names and values. - */ - public Map asSimpleMap() { - Map copy = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - for (Map.Entry> kv : this.headers.entrySet()) { - if (kv.getValue() != null) { - copy.put(kv.getKey(), kv.getValue().get(0)); - } - } - - return copy; - } - - /** - * Returns a simulated MultiMap of the headers. - * @return A Map of header names and values. - */ - public Map> asMultimap() { - return cloneHeaderMap(this.headers); - } - - /** - * Clones a header map. - * @param headerMap A Map containing header names and values as Entry pairs. - * @return A Map of header names and values. - */ - private Map> cloneHeaderMap(Map> headerMap) { - Map> copy = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - for (Map.Entry> kv : headerMap.entrySet()) { - if (kv.getValue() != null) { - copy.put(kv.getKey(), kv.getValue()); - } - } - - return copy; - } - - /** - * Adds a value for a header name to this object, - * neither headerName nor value can be null. - * @param headerName The header name to add the value against. - * @param value The value to add. - */ - public void add(String headerName, String value) { - if (headerName == null || value == null) { - return; - } - - if (this.headers.containsKey(headerName)) { - this.headers.get(headerName).add(value); - } else { - List values = new ArrayList(); - values.add(value); - this.headers.put(headerName, values); - } - } - - /** - * Adds a List of values for a header name to this object. - * neither headerName nor values can be null. - * @param headerName The header name to add the values against. - * @param values The List of values to add. - */ - public void add(String headerName, List values) { - if (headerName == null || values == null) { - return; - } - - if (this.headers.containsKey(headerName)) { - for (String value : values) { - if (value != null) { - this.headers.get(headerName).add(value); - } - } - } else { - List copyOfValues = new ArrayList(); - for (String value : values) { - if (value != null) { - copyOfValues.add(value); - } - } - - if (!copyOfValues.isEmpty()) { - this.headers.put(headerName, copyOfValues); - } - } - } - - /** - * Adds values from a Map to this object. - * @param headers A Map containing header names and values as Entry pairs. - */ - public void addAllFromMap(Map headers) { - for (Map.Entry kv : headers.entrySet()) { - this.add(kv.getKey(), kv.getValue()); - } - } - - /** - * Adds values from a simulated Multi-Map to this object. - * @param headers A Map containing header names and values as Entry pairs. - */ - public void addAllFromMultiMap(Map> headers) { - for (Map.Entry> kv : headers.entrySet()) { - this.add(kv.getKey(), kv.getValue()); - } - } - - /** - * Adds all the entries in a Headers object to this object. - * @param headers The object whose values are to be added to this object. - */ - public void addAll(Headers headers) { - for (Map.Entry> kv : headers.asMultimap().entrySet()) { - this.add(kv.getKey(), kv.getValue()); - } - } - - /** - * Removes the mapping for a header name if it is present, - * and get the value to which this map previously associated the key, - * or null if the map contained no mapping for the key. - * @param headerName The header name to remove the associated values for - * @return A List of values associated with the given header name. - */ - public List remove(String headerName) { - if (headers.containsKey(headerName)) { - return headers.remove(headerName); - } - return null; - } - - /** - * Converts this Headers into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Headers " + headers; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/HttpCallback.java b/src/main/java/com/bandwidth/http/client/HttpCallback.java deleted file mode 100644 index b1be9158..00000000 --- a/src/main/java/com/bandwidth/http/client/HttpCallback.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.request.HttpRequest; - -/** - * Callback to be called before and after the HTTP call for an endpoint is made. - */ -public interface HttpCallback { - - /** - * Callback called just before the HTTP request is sent. - * @param request The HTTP request to be executed - */ - public void onBeforeRequest(HttpRequest request); - - /** - * Callback called just after the HTTP response is received. - * @param context Context for the HTTP call - */ - public void onAfterResponse(HttpContext context); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/HttpClient.java b/src/main/java/com/bandwidth/http/client/HttpClient.java deleted file mode 100644 index 853ab2e7..00000000 --- a/src/main/java/com/bandwidth/http/client/HttpClient.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.Headers; -import com.bandwidth.http.request.HttpBodyRequest; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.HttpResponse; -import java.io.IOException; -import java.util.AbstractMap.SimpleEntry; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * HTTP Client to send HTTP Requests and read the responses. - */ -public interface HttpClient { - - /** - * Execute a given HttpRequest to get string/binary response back. - * @param request The given HttpRequest to execute. - * @param hasBinaryResponse Whether the response is binary or string. - * @return CompletableFuture of HttpResponse after execution. - */ - public CompletableFuture executeAsync(final HttpRequest request, - boolean hasBinaryResponse); - - /** - * Execute a given HttpRequest to get string/binary response back. - * @param request The given HttpRequest to execute. - * @param hasBinaryResponse Whether the response is binary or string. - * @return The converted http response. - * @throws IOException exception to be thrown while converting response. - */ - public HttpResponse execute(final HttpRequest request, boolean hasBinaryResponse) - throws IOException; - - /** - * Create a simple HTTP GET request. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - public HttpRequest get(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create a simple HTTP HEAD request. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - public HttpRequest head(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create an HTTP POST request with parameters. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - public HttpRequest post(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create an HTTP POST request with body. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param body The object to be sent as body after serialization. - * @return Returns the object of HttpBodyRequest - */ - public HttpBodyRequest postBody(StringBuilder queryUrlBuilder, - Headers headers, Map queryParams, Object body); - - /** - * Create an HTTP PUT request with parameters. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - public HttpRequest put(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create an HTTP PUT request with body. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param body The object to be sent as body after serialization. - * @return Returns the object of HttpBodyRequest - */ - HttpBodyRequest putBody(StringBuilder queryUrlBuilder, - Headers headers, Map queryParams, Object body); - - /** - * Create an HTTP PATCH request with parameters. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - public HttpRequest patch(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create an HTTP PATCH request with body. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param body The object to be sent as body after serialization. - * @return Returns the object of HttpBodyRequest - */ - public HttpBodyRequest patchBody(StringBuilder queryUrlBuilder, - Headers headers, Map queryParams, Object body); - - /** - * Create an HTTP DELETE request with parameters. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param parameters The form data values in a key-value map. - * @return Returns the object of HttpRequest - */ - HttpRequest delete(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters); - - /** - * Create an HTTP DELETE request with body. - * @param queryUrlBuilder The http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent. - * @param queryParams The query parameters in a key-value map. - * @param body The object to be sent as body after serialization. - * @return Returns the object of HttpBodyRequest - */ - public HttpBodyRequest deleteBody(StringBuilder queryUrlBuilder, - Headers headers, Map queryParams, Object body); -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/HttpClientConfiguration.java b/src/main/java/com/bandwidth/http/client/HttpClientConfiguration.java deleted file mode 100644 index f193fc50..00000000 --- a/src/main/java/com/bandwidth/http/client/HttpClientConfiguration.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.request.HttpMethod; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -/** - * Class to hold HTTP Client Configuration. - */ -public class HttpClientConfiguration implements ReadonlyHttpClientConfiguration { - - /** - * The timeout in seconds to use for making HTTP requests. - */ - private final long timeout; - - /** - * The number of retries to make. - */ - private final int numberOfRetries; - - /** - * To use in calculation of wait time for next request in case of failure. - */ - private final int backOffFactor; - - /** - * To use in calculation of wait time for next request in case of failure. - */ - private final long retryInterval; - - /** - * Http status codes to retry against. - */ - private final Set httpStatusCodesToRetry; - - /** - * Http methods to retry against. - */ - private final Set httpMethodsToRetry; - - /** - * The maximum wait time for overall retrying requests. - */ - private final long maximumRetryWaitTime; - - /** - * Whether to retry on request timeout. - */ - private final boolean shouldRetryOnTimeout; - - /** - * The OkHttpClient instance used to make the HTTP calls. - */ - private final okhttp3.OkHttpClient httpClientInstance; - - /** - * Allow the SDK to override HTTP client instance's settings used for features like retries, - * timeouts etc. - */ - private final boolean overrideHttpClientConfigurations; - - /** - * Default Constructor. - */ - private HttpClientConfiguration(long timeout, int numberOfRetries, int backOffFactor, - long retryInterval, Set httpStatusCodesToRetry, - Set httpMethodsToRetry, long maximumRetryWaitTime, - boolean shouldRetryOnTimeout, okhttp3.OkHttpClient httpClientInstance, - boolean overrideHttpClientConfigurations) { - this.timeout = timeout; - this.numberOfRetries = numberOfRetries; - this.backOffFactor = backOffFactor; - this.retryInterval = retryInterval; - this.httpStatusCodesToRetry = httpStatusCodesToRetry; - this.httpMethodsToRetry = httpMethodsToRetry; - this.maximumRetryWaitTime = maximumRetryWaitTime; - this.shouldRetryOnTimeout = shouldRetryOnTimeout; - this.httpClientInstance = httpClientInstance; - this.overrideHttpClientConfigurations = overrideHttpClientConfigurations; - } - - /** - * The timeout in seconds to use for making HTTP requests. - * @return timeout - */ - public long getTimeout() { - return timeout; - } - - /** - * The number of retries to make. - * @return numberOfRetries - */ - public int getNumberOfRetries() { - return numberOfRetries; - } - - /** - * To use in calculation of wait time for next request in case of failure. - * @return backOffFactor - */ - public int getBackOffFactor() { - return backOffFactor; - } - - /** - * To use in calculation of wait time for next request in case of failure. - * @return retryInterval - */ - public long getRetryInterval() { - return retryInterval; - } - - /** - * Http status codes to retry against. - * @return httpStatusCodesToRetry - */ - public Set getHttpStatusCodesToRetry() { - return httpStatusCodesToRetry; - } - - /** - * Http methods to retry against. - * @return httpMethodsToRetry - */ - public Set getHttpMethodsToRetry() { - return httpMethodsToRetry; - } - - /** - * The maximum wait time for overall retrying requests. - * @return maximumRetryWaitTime - */ - public long getMaximumRetryWaitTime() { - return maximumRetryWaitTime; - } - - /** - * Whether to retry on request timeout. - * @return shouldRetryOnTimeout - */ - public boolean shouldRetryOnTimeout() { - return shouldRetryOnTimeout; - } - - /** - * The OkHttpClient instance used to make the HTTP calls. - * @return httpClientInstance - */ - public okhttp3.OkHttpClient getHttpClientInstance() { - return httpClientInstance; - } - - /** - * Allow the SDK to override HTTP client instance's settings used for features like retries, - * timeouts etc. - * @return overrideHttpClientConfigurations - */ - public boolean shouldOverrideHttpClientConfigurations() { - return overrideHttpClientConfigurations; - } - - /** - * Converts this HttpClientConfiguration into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpClientConfiguration [" + "timeout=" + timeout + ", numberOfRetries=" - + numberOfRetries + ", backOffFactor=" + backOffFactor + ", retryInterval=" - + retryInterval + ", httpStatusCodesToRetry=" + httpStatusCodesToRetry - + ", httpMethodsToRetry=" + httpMethodsToRetry + ", maximumRetryWaitTime=" - + maximumRetryWaitTime + ", shouldRetryOnTimeout=" + shouldRetryOnTimeout - + ", httpClientInstance=" + httpClientInstance - + ", overrideHttpClientConfigurations=" + overrideHttpClientConfigurations + "]"; - } - - /** - * Builds a new {@link HttpClientConfiguration.Builder} object. Creates the instance with the - * current state. - * - * @return a new {@link HttpClientConfiguration.Builder} object - */ - public Builder newBuilder() { - return new Builder() - .timeout(timeout) - .numberOfRetries(numberOfRetries) - .backOffFactor(backOffFactor) - .retryInterval(retryInterval) - .httpStatusCodesToRetry(httpStatusCodesToRetry) - .httpMethodsToRetry(httpMethodsToRetry) - .maximumRetryWaitTime(maximumRetryWaitTime) - .shouldRetryOnTimeout(shouldRetryOnTimeout) - .httpClientInstance(httpClientInstance, overrideHttpClientConfigurations); - } - - /** - * Class to build instances of {@link HttpClientConfiguration}. - */ - public static class Builder { - - private long timeout = 0; - private int numberOfRetries = 0; - private int backOffFactor = 2; - private long retryInterval = 1; - private Set httpStatusCodesToRetry = new HashSet<>(); - private Set httpMethodsToRetry = new HashSet<>(); - private long maximumRetryWaitTime = 0; - private boolean shouldRetryOnTimeout = true; - private okhttp3.OkHttpClient httpClientInstance; - private boolean overrideHttpClientConfigurations = true; - - /** - * Default Constructor to initiate builder with default properties. - */ - public Builder() { - // setting default values - httpStatusCodesToRetry.addAll(Arrays.asList(408, 413, 429, 500, 502, 503, 504, 521, 522, - 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524)); - httpMethodsToRetry.addAll(Arrays.asList(HttpMethod.GET, HttpMethod.PUT, HttpMethod.GET, - HttpMethod.PUT)); - } - - /** - * The timeout in seconds to use for making HTTP requests. - * @param timeout The timeout to set. - * @return Builder - */ - public Builder timeout(long timeout) { - if (timeout > 0) { - this.timeout = timeout; - } - return this; - } - - /** - * The number of retries to make. - * @param numberOfRetries The numberOfRetries to set. - * @return Builder - */ - public Builder numberOfRetries(int numberOfRetries) { - if (numberOfRetries >= 0) { - this.numberOfRetries = numberOfRetries; - } - return this; - } - - /** - * To use in calculation of wait time for next request in case of failure. - * @param backOffFactor The backOffFactor to set. - * @return Builder - */ - public Builder backOffFactor(int backOffFactor) { - if (backOffFactor >= 1) { - this.backOffFactor = backOffFactor; - } - return this; - } - - /** - * To use in calculation of wait time for next request in case of failure. - * @param retryInterval The retryInterval to set. - * @return Builder - */ - public Builder retryInterval(long retryInterval) { - if (retryInterval >= 0) { - this.retryInterval = retryInterval; - } - return this; - } - - /** - * Http status codes to retry against. - * @param httpStatusCodesToRetry The httpStatusCodesToRetry to set. - * @return Builder - */ - public Builder httpStatusCodesToRetry(Set httpStatusCodesToRetry) { - this.httpStatusCodesToRetry.clear(); - if (httpStatusCodesToRetry != null) { - this.httpStatusCodesToRetry.addAll(httpStatusCodesToRetry); - } - return this; - } - - /** - * Http methods to retry against. - * @param httpMethodsToRetry The httpMethodsToRetry to set. - * @return Builder - */ - public Builder httpMethodsToRetry(Set httpMethodsToRetry) { - this.httpMethodsToRetry.clear(); - if (httpMethodsToRetry != null) { - this.httpMethodsToRetry.addAll(httpMethodsToRetry); - } - return this; - } - - /** - * The maximum wait time for overall retrying requests. - * @param maximumRetryWaitTime The maximumRetryWaitTime to set. - * @return Builder - */ - public Builder maximumRetryWaitTime(long maximumRetryWaitTime) { - if (maximumRetryWaitTime > 0) { - this.maximumRetryWaitTime = maximumRetryWaitTime; - } - return this; - } - - /** - * Whether to retry on request timeout. - * @param shouldRetryOnTimeout The shouldRetryOnTimeout to set - * @return Builder - */ - public Builder shouldRetryOnTimeout(boolean shouldRetryOnTimeout) { - this.shouldRetryOnTimeout = shouldRetryOnTimeout; - return this; - } - - /** - * The OkHttpClient instance used to make the HTTP calls. - * @param httpClientInstance The httpClientInstance to set - * @return Builder - */ - public Builder httpClientInstance(okhttp3.OkHttpClient httpClientInstance) { - this.httpClientInstance = httpClientInstance; - return this; - } - - /** - * The OkHttpClient instance used to make the HTTP calls. - * @param httpClientInstance The httpClientInstance to set - * @param overrideHttpClientConfigurations The overrideHttpClientConfigurations to set - * @return Builder - */ - public Builder httpClientInstance(okhttp3.OkHttpClient httpClientInstance, - boolean overrideHttpClientConfigurations) { - this.httpClientInstance = httpClientInstance; - this.overrideHttpClientConfigurations = overrideHttpClientConfigurations; - return this; - } - - /** - * Builds a new HttpClientConfiguration object using the set fields. - * @return {@link HttpClientConfiguration} - */ - public HttpClientConfiguration build() { - return new HttpClientConfiguration(timeout, numberOfRetries, backOffFactor, - retryInterval, httpStatusCodesToRetry, httpMethodsToRetry, maximumRetryWaitTime, - shouldRetryOnTimeout, httpClientInstance, overrideHttpClientConfigurations); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/HttpContext.java b/src/main/java/com/bandwidth/http/client/HttpContext.java deleted file mode 100644 index 5ea554a2..00000000 --- a/src/main/java/com/bandwidth/http/client/HttpContext.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.HttpResponse; - -/** - * Class to wrap the request sent to the server and the response received from the server. - */ -public class HttpContext { - private HttpRequest request; - private HttpResponse response; - - /** - * Initialization constructor. - * @param request Instance of HttpRequest. - * @param response Instance of HttpResponse. - */ - public HttpContext(HttpRequest request, HttpResponse response) { - this.request = request; - this.response = response; - } - - /** - * Getter for the Http Request. - * @return HttpRequest request. - */ - public HttpRequest getRequest() { - return request; - } - - /** - * Getter for the Http Response. - * @return HttpResponse response. - */ - public HttpResponse getResponse() { - return response; - } - - /** - * Converts this HttpContext into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpContext [request=" + request + ", response=" + response + "]"; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/HttpRedirectInterceptor.java b/src/main/java/com/bandwidth/http/client/HttpRedirectInterceptor.java deleted file mode 100644 index d54c2bbb..00000000 --- a/src/main/java/com/bandwidth/http/client/HttpRedirectInterceptor.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import java.io.IOException; -import java.net.ProtocolException; -import okhttp3.HttpUrl; -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; - -/** - * HttpRedirectInterceptor intercepts and complete 307 and 308 redirects as described in RFC. - */ -public class HttpRedirectInterceptor implements Interceptor { - private static final int MAX_FOLLOW_UPS = 20; - private boolean followSslRedirects; - - /** - * Initialization constructor. - * @param followSslRedirects boolean true if following ssl redirects - */ - public HttpRedirectInterceptor(boolean followSslRedirects) { - this.followSslRedirects = followSslRedirects; - } - - /** - * Intercepts and complete 307 and 308 redirects as described in RFC. - * @see okhttp3.Interceptor#intercept(okhttp3.Interceptor.Chain) - */ - @Override - public Response intercept(Chain it) throws IOException { - Request request = it.request(); - Response response = it.proceed(request); - - int followUpCount = 0; - while (response.code() == 307 || response.code() == 308) { - if (++followUpCount > MAX_FOLLOW_UPS) { - throw new ProtocolException("Too many follow-up requests: " + followUpCount); - } - - String location = response.header("Location"); - - if (location == null) { - return response; - } - - HttpUrl followUpUrl = request.url().resolve(location); - - // If configured, don't follow redirects between SSL and non-SSL. - boolean sameScheme = followUpUrl.scheme().equals(response.request().url().scheme()); - if (!sameScheme && !followSslRedirects) { - return null; - } - - Request.Builder followUpRequestBuilder = request.newBuilder().url(followUpUrl); - - // Clear out authorization header if different connection. - if (!sameConnection(request.url(), followUpUrl)) { - followUpRequestBuilder.removeHeader("Authorization"); - } - - if (response != null) { - try { - response.close(); - } catch (RuntimeException rethrown) { - throw rethrown; - } catch (Exception ignored) { - // Ignoring if its not runtime exception - } - } - - response = it.proceed(followUpRequestBuilder.build()); - } - - return response; - } - - private static boolean sameConnection(HttpUrl a, HttpUrl b) { - return a.host().equals(b.host()) && a.port() == b.port() && a.scheme().equals(b.scheme()); - } -} diff --git a/src/main/java/com/bandwidth/http/client/OkClient.java b/src/main/java/com/bandwidth/http/client/OkClient.java deleted file mode 100644 index 547e9df7..00000000 --- a/src/main/java/com/bandwidth/http/client/OkClient.java +++ /dev/null @@ -1,498 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.ApiHelper; -import com.bandwidth.http.Headers; -import com.bandwidth.http.request.HttpBodyRequest; -import com.bandwidth.http.request.HttpMethod; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.request.MultipartFileWrapper; -import com.bandwidth.http.request.MultipartWrapper; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.utilities.FileWrapper; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.AbstractMap.SimpleEntry; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; - -/** - * HTTP Client class to send HTTP Requests and read the responses. - */ -public class OkClient implements HttpClient { - private static final Object syncObject = new Object(); - private static volatile okhttp3.OkHttpClient defaultOkHttpClient; - - /** - * Private instance of the okhttp3.OkHttpClient. - */ - private okhttp3.OkHttpClient client; - - /** - * Default constructor. - * @param httpClientConfig The specified http client configuration. - */ - public OkClient(ReadonlyHttpClientConfiguration httpClientConfig) { - okhttp3.OkHttpClient httpClientInstance = httpClientConfig.getHttpClientInstance(); - if (httpClientInstance != null) { - if (httpClientConfig.shouldOverrideHttpClientConfigurations()) { - applyHttpClientConfigurations(httpClientInstance, httpClientConfig); - } else { - this.client = httpClientInstance; - } - } else { - applyHttpClientConfigurations(getDefaultOkHttpClient(), httpClientConfig); - } - } - - /** - * Applies the httpClientConfigurations on okhttp3.OkHttpClient. - */ - private void applyHttpClientConfigurations(okhttp3.OkHttpClient client, - ReadonlyHttpClientConfiguration httpClientConfig) { - okhttp3.OkHttpClient.Builder clientBuilder = client.newBuilder(); - clientBuilder.readTimeout(httpClientConfig.getTimeout(), TimeUnit.SECONDS) - .writeTimeout(httpClientConfig.getTimeout(), TimeUnit.SECONDS) - .connectTimeout(httpClientConfig.getTimeout(), TimeUnit.SECONDS); - // If retries are allowed then RetryInterceptor must be registered - if (httpClientConfig.getNumberOfRetries() > 0) { - clientBuilder.callTimeout(httpClientConfig.getMaximumRetryWaitTime(), TimeUnit.SECONDS) - .addInterceptor(new RetryInterceptor(httpClientConfig)); - } else { - clientBuilder.callTimeout(httpClientConfig.getTimeout(), TimeUnit.SECONDS); - } - - clientBuilder.addInterceptor(new HttpRedirectInterceptor(true)); - this.client = clientBuilder.build(); - } - - /** - * Getter for the default static instance of the okhttp3.OkHttpClient. - */ - private okhttp3.OkHttpClient getDefaultOkHttpClient() { - if (defaultOkHttpClient == null) { - synchronized (syncObject) { - if (defaultOkHttpClient == null) { - defaultOkHttpClient = new okhttp3.OkHttpClient.Builder() - .retryOnConnectionFailure(false) - .callTimeout(0, TimeUnit.SECONDS) - .build(); - } - } - } - return defaultOkHttpClient; - } - - /** - * Shutdown the underlying OkHttpClient instance. - */ - public static void shutdown() { - if (defaultOkHttpClient != null) { - defaultOkHttpClient.dispatcher().executorService().shutdown(); - defaultOkHttpClient.connectionPool().evictAll(); - } - } - - /** - * Execute a given HttpRequest to get string/binary response back. - * @param httpRequest The given HttpRequest to execute. - * @param hasBinaryResponse Whether the response is binary or string. - * @return CompletableFuture of HttpResponse after execution. - */ - public CompletableFuture executeAsync(final HttpRequest httpRequest, - boolean hasBinaryResponse) { - okhttp3.Request okHttpRequest = convertRequest(httpRequest); - - RetryInterceptor retryInterceptor = getRetryInterceptor(); - if (retryInterceptor != null) { - retryInterceptor.addRequestEntry(okHttpRequest); - } - - final CompletableFuture callBack = new CompletableFuture<>(); - client.newCall(okHttpRequest).enqueue(new okhttp3.Callback() { - - public void onFailure(okhttp3.Call call, IOException e) { - publishResponse(null, httpRequest, callBack, e, hasBinaryResponse); - } - - public void onResponse(okhttp3.Call call, okhttp3.Response okHttpResponse) { - publishResponse(okHttpResponse, httpRequest, callBack, null, hasBinaryResponse); - } - }); - - return callBack; - } - - /** - * Execute a given HttpRequest to get string/binary response back. - * @param httpRequest The given HttpRequest to execute. - * @param hasBinaryResponse Whether the response is binary or string. - * @return The converted http response. - * @throws IOException exception to be thrown while converting response. - */ - public HttpResponse execute(HttpRequest httpRequest, boolean hasBinaryResponse) - throws IOException { - okhttp3.Request okHttpRequest = convertRequest(httpRequest); - - RetryInterceptor retryInterceptor = getRetryInterceptor(); - if (retryInterceptor != null) { - retryInterceptor.addRequestEntry(okHttpRequest); - } - - okhttp3.Response okHttpResponse = null; - okHttpResponse = client.newCall(okHttpRequest).execute(); - return convertResponse(httpRequest, okHttpResponse, hasBinaryResponse); - } - - /** - * Returns RetryInterceptor instance registered with client. - * @return The RetryInterceptor instance. - */ - private RetryInterceptor getRetryInterceptor() { - return (RetryInterceptor) this.client.interceptors().stream() - .filter(interceptor -> interceptor instanceof RetryInterceptor).findFirst() - .orElse(null); - } - - /** - * Publishes success or failure result as HttpResponse from a HttpRequest. - * @param okHttpResponse The okhttp response to publish. - * @param httpRequest The internal http request. - * @param completionBlock The success and failure code block reference to invoke the delegate. - * @param error The reported errors for getting the http response. - * @param hasBinaryResponse Whether the response is binary or string. - * @return The converted http response. - */ - private HttpResponse publishResponse(okhttp3.Response okHttpResponse, - HttpRequest httpRequest, CompletableFuture completionBlock, - Throwable error, boolean hasBinaryResponse) { - HttpResponse httpResponse = null; - try { - httpResponse = convertResponse(httpRequest, okHttpResponse, hasBinaryResponse); - - // if there are no errors, pass on to the callback function - if (error == null && httpResponse != null) { - completionBlock.complete(httpResponse); - } else { - completionBlock.completeExceptionally(error); - } - } catch (IOException e) { - completionBlock.completeExceptionally(e); - } - return httpResponse; - } - - /** - * Converts a given OkHttp response into our internal http response model. - * @param response The given OkHttp response. - * @param hasBinaryResponse Whether the response is binary or string. - * @return The converted http response. - * @throws IOException exception to be thrown while converting response. - */ - protected static HttpResponse convertResponse(HttpRequest request, okhttp3.Response response, - boolean hasBinaryResponse) throws IOException { - HttpResponse httpResponse = null; - - if (response != null) { - - okhttp3.ResponseBody responseBody = response.body(); - - Headers headers = new Headers(response.headers().toMultimap()); - - if (hasBinaryResponse) { - InputStream responseStream = responseBody.byteStream(); - httpResponse = new HttpResponse(response.code(), headers, responseStream); - } else { - String responseString = responseBody.string(); - InputStream responseStream = new ByteArrayInputStream( - responseString.getBytes()); - httpResponse = new HttpStringResponse(response.code(), headers, responseStream, - responseString); - - responseBody.close(); - response.close(); - } - } - - return httpResponse; - } - - /** - * Converts a given internal http request into an okhttp request model. - * @param httpRequest The given http request in internal format. - * @return The converted okhttp request - */ - private okhttp3.Request convertRequest(HttpRequest httpRequest) { - okhttp3.RequestBody requestBody; - - if (httpRequest instanceof HttpBodyRequest) { - - // set request media type - String contentType; - Object body = ((HttpBodyRequest) httpRequest).getBody(); - - // set request body - if (body instanceof FileWrapper) { - FileWrapper file = (FileWrapper) body; - - if (file.getContentType() != null && !file.getContentType().isEmpty()) { - contentType = file.getContentType(); - httpRequest.getHeaders().add("content-type", contentType); - } else if (httpRequest.getHeaders().has("content-type")) { - contentType = httpRequest.getHeaders().value("content-type"); - } else { - contentType = "application/octet-stream"; - httpRequest.getHeaders().add("content-type", contentType); - } - - if (file.getFile() != null) { - requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse(contentType), - ((FileWrapper) body).getFile()); - } else { - requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse(contentType), - ((FileWrapper) body).getFileStream()); - } - - } else { - // set request body - if (!httpRequest.getHeaders().has("content-type")) { - httpRequest.getHeaders().add("content-type", "application/json; charset=UTF-8"); - } - - contentType = httpRequest.getHeaders().value("content-type"); - // set request body - requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse(contentType), - ((String) body).getBytes()); - } - } else { - - List> parameters = httpRequest.getParameters(); - boolean multipartRequest = false; - - // set request fields - if (parameters != null && parameters.size() > 0) { - // check if a request is a multipart request - for (SimpleEntry param : parameters) { - if ((param.getValue() instanceof MultipartFileWrapper) - || (param.getValue() instanceof MultipartWrapper)) { - multipartRequest = true; - break; - } - } - - if (multipartRequest) { - // make a multipart request if a file is being sent - requestBody = createMultipartRequestBody(httpRequest); - } else { - okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); - for (SimpleEntry param : parameters) { - formBuilder.add(param.getKey(), - (param.getValue() == null) ? "" : param.getValue().toString()); - } - requestBody = formBuilder.build(); - } - } else if (httpRequest.getHttpMethod().equals(HttpMethod.GET)) { - requestBody = null; - } else { - requestBody = okhttp3.RequestBody.create(null, new byte[0]); - } - } - - // set request headers - okhttp3.Headers.Builder requestHeaders = new okhttp3.Headers.Builder(); - if (httpRequest.getHeaders() != null) { - requestHeaders = createRequestHeaders(httpRequest.getHeaders()); - } - - StringBuilder urlBuilder = new StringBuilder(httpRequest.getQueryUrl()); - - // set query parameters - ApiHelper.appendUrlWithQueryParameters(urlBuilder, httpRequest.getQueryParameters()); - - // validate and preprocess url - String url = ApiHelper.cleanUrl(urlBuilder); - - // build the request - okhttp3.Request okHttpRequest = new okhttp3.Request.Builder() - .method(httpRequest.getHttpMethod().toString(), requestBody) - .headers(requestHeaders.build()).url(url) - .build(); - - return okHttpRequest; - } - - private static okhttp3.RequestBody createMultipartRequestBody(HttpRequest httpRequest) { - okhttp3.MultipartBody.Builder multipartBuilder = new okhttp3.MultipartBody.Builder() - .setType(okhttp3.MultipartBody.FORM); - - for (SimpleEntry param : httpRequest.getParameters()) { - if (param.getValue() instanceof MultipartFileWrapper) { - MultipartFileWrapper wrapperObj = (MultipartFileWrapper) param.getValue(); - okhttp3.MediaType mediaType; - if (wrapperObj.getFileWrapper().getContentType() != null - && !wrapperObj.getFileWrapper().getContentType().isEmpty()) { - mediaType = - okhttp3.MediaType.parse(wrapperObj.getFileWrapper().getContentType()); - } else { - mediaType = - okhttp3.MediaType.parse(wrapperObj.getHeaders().value("content-type")); - } - - okhttp3.RequestBody body = okhttp3.RequestBody.create(mediaType, - wrapperObj.getFileWrapper().getFile()); - Headers fileWrapperHeaders = new Headers(wrapperObj.getHeaders()); - fileWrapperHeaders.remove("content-type"); - okhttp3.Headers.Builder fileWrapperHeadersBuilder = - createRequestHeaders(fileWrapperHeaders); - - fileWrapperHeadersBuilder.add("Content-Disposition", "form-data; name=" - + appendQuotedStringAndEncodeEscapeCharacters(param.getKey()) - + "; filename=" + appendQuotedStringAndEncodeEscapeCharacters( - wrapperObj.getFileWrapper().getFile().getName())); - multipartBuilder.addPart(fileWrapperHeadersBuilder.build(), body); - } else if (param.getValue() instanceof MultipartWrapper) { - MultipartWrapper wrapperObject = (MultipartWrapper) param.getValue(); - okhttp3.RequestBody body = okhttp3.RequestBody.create( - okhttp3.MediaType.parse(wrapperObject.getHeaders().value("content-type")), - wrapperObject.getByteArray()); - Headers wrapperHeaders = new Headers(wrapperObject.getHeaders()); - wrapperHeaders.remove("content-type"); - okhttp3.Headers.Builder wrapperHeadersBuilder = - createRequestHeaders(wrapperHeaders); - - wrapperHeadersBuilder.add("Content-Disposition", "form-data; name=" - + appendQuotedStringAndEncodeEscapeCharacters(param.getKey())); - multipartBuilder.addPart(wrapperHeadersBuilder.build(), body); - } else { - multipartBuilder.addFormDataPart(param.getKey(), - (param.getValue() == null) ? "" : param.getValue().toString()); - } - } - return multipartBuilder.build(); - } - - private static okhttp3.Headers.Builder createRequestHeaders(Headers headers) { - okhttp3.Headers.Builder requestHeaders = new okhttp3.Headers.Builder(); - for (Entry> kv : headers.asMultimap().entrySet()) { - for (String value : kv.getValue()) { - requestHeaders.add(kv.getKey(), value); - } - } - return requestHeaders; - } - - private static String appendQuotedStringAndEncodeEscapeCharacters(String key) { - String target = "\""; - for (int i = 0, len = key.length(); i < len; i++) { - char ch = key.charAt(i); - switch (ch) { - case '\n': - target += "%0A"; - break; - case '\r': - target += "%0D"; - break; - case '"': - target += "%22"; - break; - default: - target += ch; - break; - } - } - target += '"'; - return target; - } - - /** - * Create a simple HTTP GET request. - */ - public HttpRequest get(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.GET, queryUrlBuilder, headers, queryParams, parameters); - } - - /** - * Create a simple HTTP HEAD request. - */ - public HttpRequest head(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.HEAD, queryUrlBuilder, headers, queryParams, parameters); - } - - /** - * Create an HTTP POST request with parameters. - */ - public HttpRequest post(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.POST, queryUrlBuilder, headers, queryParams, parameters); - } - - /** - * Create an HTTP POST request with body. - */ - public HttpBodyRequest postBody(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, Object body) { - return new HttpBodyRequest(HttpMethod.POST, queryUrlBuilder, headers, queryParams, body); - } - - - /** - * Create an HTTP PUT request with parameters. - */ - public HttpRequest put(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.PUT, queryUrlBuilder, headers, queryParams, parameters); - } - - /** - * Create an HTTP PUT request with body. - */ - public HttpBodyRequest putBody(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, Object body) { - return new HttpBodyRequest(HttpMethod.PUT, queryUrlBuilder, headers, queryParams, body); - } - - /** - * Create an HTTP PATCH request with parameters. - */ - public HttpRequest patch(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.PATCH, queryUrlBuilder, headers, queryParams, parameters); - } - - /** - * Create an HTTP PATCH request with body. - */ - public HttpBodyRequest patchBody(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, Object body) { - return new HttpBodyRequest(HttpMethod.PATCH, queryUrlBuilder, headers, queryParams, body); - } - - /** - * Create an HTTP DELETE request with parameters. - */ - public HttpRequest delete(StringBuilder queryUrl, Headers headers, - Map queryParams, List> parameters) { - return new HttpRequest(HttpMethod.DELETE, queryUrl, headers, queryParams, parameters); - } - - /** - * Create an HTTP DELETE request with body. - */ - public HttpBodyRequest deleteBody(StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, Object body) { - return new HttpBodyRequest(HttpMethod.DELETE, queryUrlBuilder, headers, queryParams, body); - } - -} diff --git a/src/main/java/com/bandwidth/http/client/ReadonlyHttpClientConfiguration.java b/src/main/java/com/bandwidth/http/client/ReadonlyHttpClientConfiguration.java deleted file mode 100644 index 1eb171f9..00000000 --- a/src/main/java/com/bandwidth/http/client/ReadonlyHttpClientConfiguration.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.request.HttpMethod; -import java.util.Set; - -/** - * Interface for holding HTTP Client Configuration. - */ -public interface ReadonlyHttpClientConfiguration { - - /** - * The timeout in seconds to use for making HTTP requests. - * @return a copy of timeout - */ - long getTimeout(); - - /** - * The number of retries to make. - * @return a copy of numberOfRetries - */ - int getNumberOfRetries(); - - /** - * To use in calculation of wait time for next request in case of failure. - * @return a copy of backOffFactor - */ - int getBackOffFactor(); - - /** - * To use in calculation of wait time for next request in case of failure. - * @return a copy of retryInterval - */ - long getRetryInterval(); - - /** - * Http status codes to retry against. - * @return a copy of httpStatusCodesToRetry - */ - Set getHttpStatusCodesToRetry(); - - /** - * Http methods to retry against. - * @return a copy of httpMethodsToRetry - */ - Set getHttpMethodsToRetry(); - - /** - * The maximum wait time for overall retrying requests. - * @return a copy of maximumRetryWaitTime - */ - long getMaximumRetryWaitTime(); - - /** - * Whether to retry on request timeout. - * @return a copy of shouldRetryOnTimeout - */ - boolean shouldRetryOnTimeout(); - - /** - * The OkHttpClient instance used to make the HTTP calls. - * @return a copy of httpClientInstance - */ - okhttp3.OkHttpClient getHttpClientInstance(); - - /** - * Allow the SDK to override HTTP client instance's settings used for features like retries, - * timeouts etc. - * @return a copy of overrideHttpClientConfigurations - */ - boolean shouldOverrideHttpClientConfigurations(); - -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/client/RetryInterceptor.java b/src/main/java/com/bandwidth/http/client/RetryInterceptor.java deleted file mode 100644 index dbc87dd4..00000000 --- a/src/main/java/com/bandwidth/http/client/RetryInterceptor.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.client; - -import com.bandwidth.http.request.HttpMethod; -import java.io.IOException; -import java.net.SocketException; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.TimeUnit; -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; - -/** - * RetryInterceptor intercepts and retry requests if failed based on configuration. - */ -public class RetryInterceptor implements Interceptor { - - private static final DateTimeFormatter RFC1123_DATE_TIME_FORMATTER = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z") - .withZone(ZoneId.of("GMT")); - - /** - * To keep track of requests being sent and its current state. - */ - private final ConcurrentMap requestEntries; - - /** - * User specified retry configurations. - */ - private final ReadonlyHttpClientConfiguration httpClientConfiguration; - - /** - * Default Constructor, Initializes the httpClientConfiguration attribute. - * - * @param httpClientConfig the user specified configurations. - */ - public RetryInterceptor(ReadonlyHttpClientConfiguration httpClientConfig) { - this.httpClientConfiguration = httpClientConfig; - requestEntries = new ConcurrentHashMap<>(); - } - - /** - * Intercepts and retry requests if failed based on configuration. - * @see okhttp3.Interceptor#intercept(okhttp3.Interceptor.Chain) - */ - @SuppressWarnings("resource") - @Override - public Response intercept(Chain chain) throws IOException { - Request request = chain.request(); - RequestState requestState = getRequestState(request); - Response response = null; - try { - response = chain.proceed(request); - } catch (IOException ioException) { - if (httpClientConfiguration.shouldRetryOnTimeout() - && httpClientConfiguration.getNumberOfRetries() > 0) { - response = retryOnTimeout(chain, request, requestState, ioException); - } - } - while (requestState != null && needToRetry(request, response)) { - requestState.retryCount++; - // Performing wait time calculation. - calculateWaitTime(requestState, response); - - // Checking total wait time against allowed max back-off time - if (hasWaitTimeLimitExceeded(requestState)) { - break; - } - - - // Waiting before making next request - holdExecution(requestState); - // proceeding with execution of next request - try { - response.close(); - response = chain.proceed(request); - } catch (SocketException socketException) { - response = chain.proceed(request); - } catch (IOException ioException) { - if (httpClientConfiguration.shouldRetryOnTimeout() - && httpClientConfiguration.getNumberOfRetries() > 0) { - response = retryOnTimeout(chain, request, requestState, ioException); - } - } - - } - - this.requestEntries.remove(request); - return response; - } - - /** - * Adds entry into Request entry map. - * @param okHttpRequest the OK HTTP Request. - */ - public void addRequestEntry(Request okHttpRequest) { - this.requestEntries.put(okHttpRequest, new RequestState()); - } - - /** - * Checks if the overall wait time has reached to its limit. - * @param requestState the current state of request entry. - * @return true if total wait time exceeds maximum back-off time. - */ - private boolean hasWaitTimeLimitExceeded(RequestState requestState) { - return this.httpClientConfiguration.getMaximumRetryWaitTime() > 0 - && toMilliseconds(this.httpClientConfiguration - .getMaximumRetryWaitTime()) < requestState.totalWaitTimeInMilliSeconds; - } - - - /** - * Checks if the retry request is to be made against provided response. - * @param request the HTTP request. - * @param response the HTTP response. - * @return true if request is needed to be retried. - */ - private boolean needToRetry(Request request, Response response) { - - return (getRequestState(request).retryCount < this.httpClientConfiguration - .getNumberOfRetries() - && this.httpClientConfiguration.getHttpMethodsToRetry() - .contains(HttpMethod.valueOf(request.method())) - && response != null && (this.httpClientConfiguration.getHttpStatusCodesToRetry() - .contains(response.code()) || hasRetryAfterHeader(response))); - } - - /** - * Calculates the wait time for next request. - * @param requestState the current state of request entry. - * @param response the HTTP response. - */ - private void calculateWaitTime(RequestState requestState, Response response) { - long retryAfterHeaderValue = 0; - if (hasRetryAfterHeader(response)) { - retryAfterHeaderValue = getCalculatedHeaderValue(response.header("Retry-After")); - } - long calculatedBackOffInMilliSeconds = getCalculatedBackOffValue(requestState); - requestState.currentWaitInMilliSeconds = - calculatedBackOffInMilliSeconds > retryAfterHeaderValue - ? calculatedBackOffInMilliSeconds - : retryAfterHeaderValue; - requestState.totalWaitTimeInMilliSeconds += requestState.currentWaitInMilliSeconds; - } - - /** - * Checks if the response contains Retry-After header. - * @param response the HTTP response. - * @return true if response contains Retry-After header. - */ - private boolean hasRetryAfterHeader(Response response) { - String retryAfter = response.header("Retry-After"); - if (retryAfter != null && !retryAfter.isEmpty()) { - return true; - } - return false; - } - - /** - * Analyzes the header value and checks the header if it contains date in proper format or - * seconds. If header value is date then it calculates the delta time in milliseconds. - * @param headerValue the retry-after header value. - * @return long value of calculated wait time in milliseconds. - */ - private long getCalculatedHeaderValue(String headerValue) { - try { - return toMilliseconds(Long.parseLong(headerValue)); - } catch (NumberFormatException nfe) { - long requestAtValueInSeconds = LocalDateTime - .parse(headerValue, RFC1123_DATE_TIME_FORMATTER).toEpochSecond(ZoneOffset.UTC); - long currentDateTimeInSeconds = LocalDateTime - .now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC); - return toMilliseconds(requestAtValueInSeconds - currentDateTimeInSeconds); - } - } - - /** - * Calculates the back-off value based on a formula which uses back-off factor and retry Count. - * @param requestState the current state of request entry. - * @return long value of back-off time based on formula in milliseconds. - */ - private long getCalculatedBackOffValue(RequestState requestState) { - return (long) (1000 * this.httpClientConfiguration.getRetryInterval() - * Math.pow(this.httpClientConfiguration.getBackOffFactor(), - requestState.retryCount - 1) + Math.random() * 100); - } - - /** - * Holds the execution for stored wait time in milliseconds of this thread. - * @param requestState the current state of request entry. - */ - private void holdExecution(RequestState requestState) { - try { - TimeUnit.MILLISECONDS.sleep(requestState.currentWaitInMilliSeconds); - } catch (InterruptedException e) { - // No handler needed - } - } - - /** - * Converts the seconds to milliseconds. - * @param seconds The seconds to convert. - * @return long value of milliseconds. - */ - private long toMilliseconds(long seconds) { - return seconds * 1000; - } - - /** - * getter for current request state entry from map. - * @param okHttpRequest the OK HTTP Request. - * @return RequestEntry the current request entry. - */ - private RequestState getRequestState(Request okHttpRequest) { - return this.requestEntries.get(okHttpRequest); - } - - /** - * Retries on the request which caused the request timeout to occur based on HTTP Client - * Configurations. - * @param chain The interceptor chain. - * @param request The OkHttp request. - * @param exception The thrown exception. - * @return The OKHttp response. - * @throws IOException the same exception which was thrown while retrying. - */ - private okhttp3.Response retryOnTimeout(Chain chain, Request request, RequestState requestState, - IOException exception) throws IOException { - - while (requestState.retryCount++ < httpClientConfiguration.getNumberOfRetries() - && !this.hasWaitTimeLimitExceeded(requestState)) { - - try { - return chain.proceed(request); - } catch (IOException ioException) { - exception = ioException; - } finally { - requestState.totalWaitTimeInMilliSeconds += - toMilliseconds(httpClientConfiguration.getTimeout()); - } - } - - throw exception; - } - - - /** - * Class to hold the request info until request completes. - */ - private class RequestState { - - /** - * To keep track of requests count. - */ - private int retryCount = 0; - - /** - * To store the wait time for next request. - */ - private long currentWaitInMilliSeconds = 0; - - /** - * To keep track of overall wait time. - */ - private long totalWaitTimeInMilliSeconds = 0; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/request/HttpBodyRequest.java b/src/main/java/com/bandwidth/http/request/HttpBodyRequest.java deleted file mode 100644 index c7127f8e..00000000 --- a/src/main/java/com/bandwidth/http/request/HttpBodyRequest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.request; - -import com.bandwidth.http.Headers; -import java.util.Map; - -/** - * HTTP Request with an explicit body. - */ -public class HttpBodyRequest extends HttpRequest { - - /** - * Private store for properties. - */ - private Object body; - - /** - * Create a request with explicit body. - * @param method The HTTP method to use. Can be PUT, POST, DELETE and PATCH - * @param queryUrlBuilder The fully qualified absolute http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent - * @param queryParams The query parameters in a key-value map - * @param body The object to be sent as body after serialization - */ - public HttpBodyRequest(HttpMethod method, StringBuilder queryUrlBuilder, Headers headers, - Map queryParams, Object body) { - super(method, queryUrlBuilder, headers, queryParams, null); - this.body = body != null ? body : ""; - } - - /** - * Body for the http request. - * @return Object body - */ - public Object getBody() { - return body; - } - - /** - * Converts this HttpBodyRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpBodyRequest [httpMethod=" + getHttpMethod() - + ", headers=" + getHeaders() + ", queryUrlBuilder=" + getQueryUrl() - + ", queryParameters=" + getQueryParameters() + ", body=" + body + "]"; - } -} diff --git a/src/main/java/com/bandwidth/http/request/HttpMethod.java b/src/main/java/com/bandwidth/http/request/HttpMethod.java deleted file mode 100644 index e0f8df12..00000000 --- a/src/main/java/com/bandwidth/http/request/HttpMethod.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.request; - -/** - * HTTP methods enumeration. - */ -public enum HttpMethod { - GET, - POST, - PUT, - PATCH, - DELETE, - HEAD -} diff --git a/src/main/java/com/bandwidth/http/request/HttpRequest.java b/src/main/java/com/bandwidth/http/request/HttpRequest.java deleted file mode 100644 index b88c5e33..00000000 --- a/src/main/java/com/bandwidth/http/request/HttpRequest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.request; - -import com.bandwidth.http.Headers; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Class for creating and managing HTTP Requests. - */ -public class HttpRequest { - - /** - * Private store for properties. - */ - private HttpMethod httpMethod; - private Headers headers; - private StringBuilder queryUrlBuilder; - private List> parameters; - private Map queryParameters; - - /** - * Initializes a simple http request. - * @param method The HTTP method to use. Can be GET, HEAD, PUT, POST, DELETE and PATCH - * @param queryUrlBuilder The fully qualified absolute http url to create the HTTP Request. - * @param headers The key-value map of all http headers to be sent - * @param queryParameters The query parameters in a key-value map - * @param parameters The form data values in a key-value map - */ - public HttpRequest(HttpMethod method, StringBuilder queryUrlBuilder, Headers headers, - Map queryParameters, List> parameters) { - this.httpMethod = method; - this.queryUrlBuilder = queryUrlBuilder; - this.headers = headers; - this.queryParameters = queryParameters; - this.parameters = parameters; - } - - /** - * HttpMethod for the http request. - * @return HttpMethod - */ - public HttpMethod getHttpMethod() { - return httpMethod; - } - - /** - * Headers for the http request. - * @return Headers - */ - public Headers getHeaders() { - return headers; - } - - /** - * Query url for the http request. - * @return String query url - */ - public String getQueryUrl() { - return queryUrlBuilder.toString(); - } - - /** - * Parameters for the http request. - * @return List of simple entries for form parameters - */ - public List> getParameters() { - return parameters; - } - - /** - * Query parameters for the http request. - * @return Map of queryParameters - */ - public Map getQueryParameters() { - return queryParameters; - } - - /** - * Add Query parameter in http request. - * @param key The key of query parameter to be added - * @param value The value for respective query parameter - */ - public void addQueryParameter(String key, Object value) { - if (key == null || key.isEmpty() || value == null) { - return; - } - if (queryParameters == null) { - queryParameters = new HashMap(); - } - queryParameters.put(key, value); - } - - /** - * Converts this HttpRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpRequest [httpMethod=" + httpMethod + ", headers=" + headers - + ", queryUrlBuilder=" + queryUrlBuilder + ", queryParameters=" + queryParameters - + ", parameters=" + parameters + "]"; - } -} diff --git a/src/main/java/com/bandwidth/http/request/MultipartFileWrapper.java b/src/main/java/com/bandwidth/http/request/MultipartFileWrapper.java deleted file mode 100644 index 34c3b212..00000000 --- a/src/main/java/com/bandwidth/http/request/MultipartFileWrapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.request; - -import com.bandwidth.http.Headers; -import com.bandwidth.utilities.FileWrapper; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Class to wrap file and headers to be sent as part of a multipart request. - */ -public class MultipartFileWrapper { - - @JsonInclude(JsonInclude.Include.NON_NULL) - private FileWrapper fileWrapper; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Headers headers; - - /** - * Initialization constructor. - * @param fileWrapper FileWrapper instance - * @param headers Headers for wrapping - */ - public MultipartFileWrapper(FileWrapper fileWrapper, Headers headers) { - this.fileWrapper = fileWrapper; - this.headers = headers; - } - - /** - * Getter for file wrapper. - * @return FileWrapper instance - */ - public FileWrapper getFileWrapper() { - return fileWrapper; - } - - /** - * Getter for headers. - * @return Headers - */ - public Headers getHeaders() { - return headers; - } -} diff --git a/src/main/java/com/bandwidth/http/request/MultipartWrapper.java b/src/main/java/com/bandwidth/http/request/MultipartWrapper.java deleted file mode 100644 index 76216107..00000000 --- a/src/main/java/com/bandwidth/http/request/MultipartWrapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.request; - -import com.bandwidth.http.Headers; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Class to wrap byteArray and headers to be sent as part of a multipart request. - */ -public class MultipartWrapper { - - @JsonInclude(JsonInclude.Include.NON_NULL) - private String serializedObj; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Headers headers; - - /** - * Initialization constructor. - * @param serializedObj Serialized string of object to be wrapped. - * @param headers Headers for wrapping - */ - public MultipartWrapper(String serializedObj, Headers headers) { - this.serializedObj = serializedObj; - this.headers = headers; - } - - /** - * Getter for bytes. - * @return Array of bytes. - */ - public byte[] getByteArray() { - return serializedObj.getBytes(); - } - - /** - * Getter for headers. - * @return headers - */ - public Headers getHeaders() { - return headers; - } -} diff --git a/src/main/java/com/bandwidth/http/response/ApiResponse.java b/src/main/java/com/bandwidth/http/response/ApiResponse.java deleted file mode 100644 index 0dbaa2cf..00000000 --- a/src/main/java/com/bandwidth/http/response/ApiResponse.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.response; - -import com.bandwidth.http.Headers; - -public class ApiResponse { - - /** - * Private store for properties. - */ - int statusCode; - Headers headers; - T result; - - /** - * HTTP Status code of the api response. - * @return Int status code - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Headers of the http response. - * @return Headers - */ - public Headers getHeaders() { - return headers; - } - - /** - * The deserialized result of the api response. - * @return result of type T - */ - public T getResult() { - return result; - } - - /** - * Initialization constructor. - * @param statusCode The HTTP Status code of the api response - * @param headers The Headers of the http response - * @param result The wrapped response of type T - */ - public ApiResponse(int statusCode, Headers headers, T result) { - this.statusCode = statusCode; - this.headers = headers; - this.result = result; - } - -} diff --git a/src/main/java/com/bandwidth/http/response/HttpResponse.java b/src/main/java/com/bandwidth/http/response/HttpResponse.java deleted file mode 100644 index bdc1b0b9..00000000 --- a/src/main/java/com/bandwidth/http/response/HttpResponse.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.response; - -import com.bandwidth.http.Headers; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.stream.Collectors; - -/** - * Class to hold HTTP Response. - */ -public class HttpResponse { - - /** - * Private store for properties. - */ - private int statusCode; - private Headers headers; - private InputStream rawBody; - - /** - * Initialization constructor. - * @param code The HTTP status code - * @param headers The HTTP headers read from response - * @param rawBody The raw data returned in the HTTP response - */ - public HttpResponse(int code, Headers headers, InputStream rawBody) { - this.statusCode = code; - this.headers = headers; - this.rawBody = rawBody; - } - - /** - * HTTP Status code of the http response. - * @return Int status code - */ - public int getStatusCode() { - return statusCode; - } - - /** - * Headers of the http response. - * @return Headers - */ - public Headers getHeaders() { - return headers; - } - - /** - * Raw body of the http response. - * @return InputStream - */ - public InputStream getRawBody() { - return rawBody; - } - - /** - * String representation for raw body of the http response. - * @return String - */ - protected String getRawBodyString() { - try { - if (rawBody == null || rawBody.available() == 0 || !rawBody.markSupported()) { - return null; - } - rawBody.mark(0); - String result = new BufferedReader(new InputStreamReader(rawBody)).lines() - .collect(Collectors.joining("\n")); - rawBody.reset(); - return result; - } catch (IOException e) { - return null; - } - } - - /** - * Converts this HttpResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpResponse [statusCode=" + statusCode + ", headers=" + headers + ", rawBody=" - + getRawBodyString() + "]"; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/http/response/HttpStringResponse.java b/src/main/java/com/bandwidth/http/response/HttpStringResponse.java deleted file mode 100644 index d264159a..00000000 --- a/src/main/java/com/bandwidth/http/response/HttpStringResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.http.response; - -import com.bandwidth.http.Headers; -import java.io.InputStream; - -/** - * Class to hold response body as string. - */ -public class HttpStringResponse extends HttpResponse { - - /** - * Private store for properties. - */ - private String body; - - /** - * Initialization constructor. - * @param code The HTTP status code - * @param headers The HTTP headers read from response - * @param rawBody The raw data returned in the HTTP response - * @param body String response body - */ - public HttpStringResponse(int code, Headers headers, InputStream rawBody, String body) { - super(code, headers, rawBody); - this.body = body; - } - - /** - * String body of the http response. - * @return String response body - */ - public String getBody() { - return body; - } - - /** - * Converts this HttpStringResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "HttpStringResponse [statusCode=" + getStatusCode() + ", headers=" + getHeaders() - + ", body=" + body + "]"; - } -} diff --git a/src/main/java/com/bandwidth/internal/OptionalNullable.java b/src/main/java/com/bandwidth/internal/OptionalNullable.java deleted file mode 100644 index ed0a4653..00000000 --- a/src/main/java/com/bandwidth/internal/OptionalNullable.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.internal; - -import com.bandwidth.DateTimeHelper; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import java.io.IOException; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -/** - * Class to encapsulate fields which are Optional as well as Nullable. It also - * provides helper methods to create OptionalNullable generic type, and to - * extract value from it. - * @param Type of the encapsulated field. - */ -public class OptionalNullable { - - /** - * Private store for encapsulated object's value. - */ - private T value; - - private OptionalNullable(T value) { - this.value = value; - } - - /** - * Converts this OptionalNullable into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "" + value; - } - - /** - * Creates an OptionalNullable instance with the provided value. - * @param Type of the provided object. - * @param value Value of the provided object. - * @return {@link OptionalNullable} instance encapsulating given value. - */ - public static OptionalNullable of(T value) { - return new OptionalNullable(value); - } - - /** - * Extracts the encapsulated value from the given OptionalNullable. - * @param Type of the expected value. - * @param optionalNullable OptionalNullable instance to get value. - * @return Value of the extracted field. - */ - public static T getFrom(OptionalNullable optionalNullable) { - return (optionalNullable == null) ? null : optionalNullable.value; - } - - /** - * JsonSerializer for the {@link OptionalNullable} instance. It is used to - * Serialize an {@link OptionalNullable} as its encapsulated object. - */ - public static class Serializer extends JsonSerializer> { - @Override - public void serialize(OptionalNullable object, JsonGenerator jgen, - SerializerProvider provider) throws IOException { - jgen.writeObject(object.value); - } - } - - /** - * A class to handle serialization of Unix Timestamps to DateTime objects. - */ - public static class UnixTimestampSerializer extends JsonSerializer> { - @SuppressWarnings("unchecked") - @Override - public void serialize(OptionalNullable object, JsonGenerator jgen, - SerializerProvider provider) throws IOException { - if (object.value instanceof List) { - jgen.writeObject( - DateTimeHelper.toUnixTimestampLong((List) object.value)); - } else if (object.value instanceof Map) { - jgen.writeObject(DateTimeHelper - .toUnixTimestampLong((Map) object.value)); - } else { - jgen.writeObject(DateTimeHelper.toUnixTimestampLong((LocalDateTime) object.value)); - } - } - } - - /** - * A class to handle serialization of Rfc1123 format strings to DateTime - * objects. - */ - public static class Rfc1123DateTimeSerializer extends JsonSerializer> { - @SuppressWarnings("unchecked") - @Override - public void serialize(OptionalNullable object, JsonGenerator jgen, - SerializerProvider provider) throws IOException { - if (object.value instanceof List) { - jgen.writeObject( - DateTimeHelper.toRfc1123DateTime((List) object.value)); - } else if (object.value instanceof Map) { - jgen.writeObject(DateTimeHelper - .toRfc1123DateTime((Map) object.value)); - } else { - jgen.writeString(DateTimeHelper.toRfc1123DateTime((LocalDateTime) object.value)); - } - } - } - - /** - * A class to handle serialization of Rfc8601(Rfc3339) format strings to - * DateTime objects. - */ - public static class Rfc8601DateTimeSerializer extends JsonSerializer> { - @SuppressWarnings("unchecked") - @Override - public void serialize(OptionalNullable object, JsonGenerator jgen, - SerializerProvider provider) throws IOException { - if (object.value instanceof List) { - jgen.writeObject( - DateTimeHelper.toRfc8601DateTime((List) object.value)); - } else if (object.value instanceof Map) { - jgen.writeObject(DateTimeHelper - .toRfc8601DateTime((Map) object.value)); - } else { - jgen.writeString(DateTimeHelper.toRfc8601DateTime((LocalDateTime) object.value)); - } - } - } - - /** - * A class to handle serialization of LocalDate objects to date strings. - */ - public static class SimpleDateSerializer extends JsonSerializer> { - @SuppressWarnings("unchecked") - @Override - public void serialize(OptionalNullable object, JsonGenerator jgen, - SerializerProvider provider) throws IOException { - if (object.value instanceof List) { - jgen.writeObject(DateTimeHelper.toSimpleDate((List) object.value)); - } else if (object.value instanceof Map) { - jgen.writeObject( - DateTimeHelper.toSimpleDate((Map) object.value)); - } else { - jgen.writeString(DateTimeHelper.toSimpleDate((LocalDate) object.value)); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/messaging/controllers/APIController.java b/src/main/java/com/bandwidth/messaging/controllers/APIController.java deleted file mode 100644 index 52742cea..00000000 --- a/src/main/java/com/bandwidth/messaging/controllers/APIController.java +++ /dev/null @@ -1,864 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.controllers; - -import com.bandwidth.ApiHelper; -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.Server; -import com.bandwidth.controllers.BaseController; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.Headers; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.messaging.exceptions.MessagingException; -import com.bandwidth.messaging.models.BandwidthMessage; -import com.bandwidth.messaging.models.BandwidthMessagesList; -import com.bandwidth.messaging.models.Media; -import com.bandwidth.messaging.models.MessageRequest; -import com.bandwidth.utilities.FileWrapper; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.io.InputStream; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * This class lists all the endpoints of the groups. - */ -public final class APIController extends BaseController { - - /** - * Initializes the controller. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers) { - super(config, httpClient, authManagers); - } - - /** - * Initializes the controller with HTTPCallback. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - * @param httpCallback Callback to be called before and after the HTTP call. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - super(config, httpClient, authManagers, httpCallback); - } - - /** - * Gets a list of your media files. No query parameters are supported. - * @param accountId Required parameter: User's account ID - * @param continuationToken Optional parameter: Continuation token used to retrieve subsequent - * media. - * @return Returns the List of Media wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> listMedia( - final String accountId, - final String continuationToken) throws ApiException, IOException { - HttpRequest request = buildListMediaRequest(accountId, continuationToken); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleListMediaResponse(context); - } - - /** - * Gets a list of your media files. No query parameters are supported. - * @param accountId Required parameter: User's account ID - * @param continuationToken Optional parameter: Continuation token used to retrieve subsequent - * media. - * @return Returns the List of Media wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> listMediaAsync( - final String accountId, - final String continuationToken) { - return makeHttpCallAsync(() -> buildListMediaRequest(accountId, continuationToken), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleListMediaResponse(context)); - } - - /** - * Builds the HttpRequest object for listMedia. - */ - private HttpRequest buildListMediaRequest( - final String accountId, - final String continuationToken) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/media"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("Continuation-Token", continuationToken); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for listMedia. - * @return An object of type List of Media - */ - private ApiResponse> handleListMediaResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - Media[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Downloads a media file you previously uploaded. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: Media ID to retrieve - * @return Returns the InputStream wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getMedia( - final String accountId, - final String mediaId) throws ApiException, IOException { - HttpRequest request = buildGetMediaRequest(accountId, mediaId); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, true); - HttpContext context = new HttpContext(request, response); - - return handleGetMediaResponse(context); - } - - /** - * Downloads a media file you previously uploaded. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: Media ID to retrieve - * @return Returns the InputStream wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getMediaAsync( - final String accountId, - final String mediaId) { - return makeHttpCallAsync(() -> buildGetMediaRequest(accountId, mediaId), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, true)), - context -> handleGetMediaResponse(context)); - } - - /** - * Builds the HttpRequest object for getMedia. - */ - private HttpRequest buildGetMediaRequest( - final String accountId, - final String mediaId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/media/{mediaId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("mediaId", - new SimpleEntry(mediaId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getMedia. - * @return An object of type InputStream - */ - private ApiResponse handleGetMediaResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - InputStream result = response.getRawBody(); - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Uploads a file the normal HTTP way. You may add headers to the request in order to provide - * some control to your media-file. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: The user supplied custom media ID - * @param body Required parameter: Example: - * @param contentType Optional parameter: The media type of the entity-body - * @param cacheControl Optional parameter: General-header field is used to specify directives - * that MUST be obeyed by all caching mechanisms along the request/response chain. - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse uploadMedia( - final String accountId, - final String mediaId, - final FileWrapper body, - final String contentType, - final String cacheControl) throws ApiException, IOException { - HttpRequest request = buildUploadMediaRequest(accountId, mediaId, body, contentType, - cacheControl); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleUploadMediaResponse(context); - } - - /** - * Uploads a file the normal HTTP way. You may add headers to the request in order to provide - * some control to your media-file. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: The user supplied custom media ID - * @param body Required parameter: Example: - * @param contentType Optional parameter: The media type of the entity-body - * @param cacheControl Optional parameter: General-header field is used to specify directives - * that MUST be obeyed by all caching mechanisms along the request/response chain. - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> uploadMediaAsync( - final String accountId, - final String mediaId, - final FileWrapper body, - final String contentType, - final String cacheControl) { - return makeHttpCallAsync(() -> buildUploadMediaRequest(accountId, mediaId, body, - contentType, cacheControl), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleUploadMediaResponse(context)); - } - - /** - * Builds the HttpRequest object for uploadMedia. - */ - private HttpRequest buildUploadMediaRequest( - final String accountId, - final String mediaId, - final FileWrapper body, - final String contentType, - final String cacheControl) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/media/{mediaId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("mediaId", - new SimpleEntry(mediaId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("Content-Type", - (contentType != null) ? contentType : "application/octet-stream"); - headers.add("Cache-Control", cacheControl); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, body); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for uploadMedia. - * @return An object of type void - */ - private ApiResponse handleUploadMediaResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Deletes a media file from Bandwidth API server. Make sure you don't have any application - * scripts still using the media before you delete. If you accidentally delete a media file, you - * can immediately upload a new file with the same name. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: The media ID to delete - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteMedia( - final String accountId, - final String mediaId) throws ApiException, IOException { - HttpRequest request = buildDeleteMediaRequest(accountId, mediaId); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteMediaResponse(context); - } - - /** - * Deletes a media file from Bandwidth API server. Make sure you don't have any application - * scripts still using the media before you delete. If you accidentally delete a media file, you - * can immediately upload a new file with the same name. - * @param accountId Required parameter: User's account ID - * @param mediaId Required parameter: The media ID to delete - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteMediaAsync( - final String accountId, - final String mediaId) { - return makeHttpCallAsync(() -> buildDeleteMediaRequest(accountId, mediaId), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteMediaResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteMedia. - */ - private HttpRequest buildDeleteMediaRequest( - final String accountId, - final String mediaId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/media/{mediaId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("mediaId", - new SimpleEntry(mediaId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteMedia. - * @return An object of type void - */ - private ApiResponse handleDeleteMediaResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Gets a list of messages based on query parameters. - * @param accountId Required parameter: User's account ID - * @param messageId Optional parameter: The ID of the message to search for. Special - * characters need to be encoded using URL encoding - * @param sourceTn Optional parameter: The phone number that sent the message - * @param destinationTn Optional parameter: The phone number that received the message - * @param messageStatus Optional parameter: The status of the message. One of RECEIVED, - * QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED - * @param errorCode Optional parameter: The error code of the message - * @param fromDateTime Optional parameter: The start of the date range to search in ISO 8601 - * format. Uses the message receive time. The date range to search in is currently 14 - * days. - * @param toDateTime Optional parameter: The end of the date range to search in ISO 8601 - * format. Uses the message receive time. The date range to search in is currently 14 - * days. - * @param pageToken Optional parameter: A base64 encoded value used for pagination of results - * @param limit Optional parameter: The maximum records requested in search result. Default - * 100. The sum of limit and after cannot be more than 10000 - * @return Returns the BandwidthMessagesList wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getMessages( - final String accountId, - final String messageId, - final String sourceTn, - final String destinationTn, - final String messageStatus, - final Integer errorCode, - final String fromDateTime, - final String toDateTime, - final String pageToken, - final Integer limit) throws ApiException, IOException { - HttpRequest request = buildGetMessagesRequest(accountId, messageId, sourceTn, destinationTn, - messageStatus, errorCode, fromDateTime, toDateTime, pageToken, limit); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetMessagesResponse(context); - } - - /** - * Gets a list of messages based on query parameters. - * @param accountId Required parameter: User's account ID - * @param messageId Optional parameter: The ID of the message to search for. Special - * characters need to be encoded using URL encoding - * @param sourceTn Optional parameter: The phone number that sent the message - * @param destinationTn Optional parameter: The phone number that received the message - * @param messageStatus Optional parameter: The status of the message. One of RECEIVED, - * QUEUED, SENDING, SENT, FAILED, DELIVERED, ACCEPTED, UNDELIVERED - * @param errorCode Optional parameter: The error code of the message - * @param fromDateTime Optional parameter: The start of the date range to search in ISO 8601 - * format. Uses the message receive time. The date range to search in is currently 14 - * days. - * @param toDateTime Optional parameter: The end of the date range to search in ISO 8601 - * format. Uses the message receive time. The date range to search in is currently 14 - * days. - * @param pageToken Optional parameter: A base64 encoded value used for pagination of results - * @param limit Optional parameter: The maximum records requested in search result. Default - * 100. The sum of limit and after cannot be more than 10000 - * @return Returns the BandwidthMessagesList wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getMessagesAsync( - final String accountId, - final String messageId, - final String sourceTn, - final String destinationTn, - final String messageStatus, - final Integer errorCode, - final String fromDateTime, - final String toDateTime, - final String pageToken, - final Integer limit) { - return makeHttpCallAsync(() -> buildGetMessagesRequest(accountId, messageId, sourceTn, - destinationTn, messageStatus, errorCode, fromDateTime, toDateTime, pageToken, - limit), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetMessagesResponse(context)); - } - - /** - * Builds the HttpRequest object for getMessages. - */ - private HttpRequest buildGetMessagesRequest( - final String accountId, - final String messageId, - final String sourceTn, - final String destinationTn, - final String messageStatus, - final Integer errorCode, - final String fromDateTime, - final String toDateTime, - final String pageToken, - final Integer limit) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/messages"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all query parameters - Map queryParameters = new HashMap<>(); - queryParameters.put("messageId", messageId); - queryParameters.put("sourceTn", sourceTn); - queryParameters.put("destinationTn", destinationTn); - queryParameters.put("messageStatus", messageStatus); - queryParameters.put("errorCode", errorCode); - queryParameters.put("fromDateTime", fromDateTime); - queryParameters.put("toDateTime", toDateTime); - queryParameters.put("pageToken", pageToken); - queryParameters.put("limit", limit); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters, - null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getMessages. - * @return An object of type BandwidthMessagesList - */ - private ApiResponse handleGetMessagesResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - BandwidthMessagesList result = ApiHelper.deserialize(responseBody, - BandwidthMessagesList.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Endpoint for sending text messages and picture messages using V2 messaging. - * @param accountId Required parameter: User's account ID - * @param body Required parameter: Example: - * @return Returns the BandwidthMessage wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createMessage( - final String accountId, - final MessageRequest body) throws ApiException, IOException { - HttpRequest request = buildCreateMessageRequest(accountId, body); - authManagers.get("messaging").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateMessageResponse(context); - } - - /** - * Endpoint for sending text messages and picture messages using V2 messaging. - * @param accountId Required parameter: User's account ID - * @param body Required parameter: Example: - * @return Returns the BandwidthMessage wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createMessageAsync( - final String accountId, - final MessageRequest body) { - return makeHttpCallAsync(() -> buildCreateMessageRequest(accountId, body), - req -> authManagers.get("messaging").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateMessageResponse(context)); - } - - /** - * Builds the HttpRequest object for createMessage. - */ - private HttpRequest buildCreateMessageRequest( - final String accountId, - final MessageRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MESSAGINGDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/users/{accountId}/messages"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createMessage. - * @return An object of type BandwidthMessage - */ - private ApiResponse handleCreateMessageResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new MessagingException("400 Request is malformed or invalid", context); - } - if (responseCode == 401) { - throw new MessagingException( - "401 The specified user does not have access to the account", context); - } - if (responseCode == 403) { - throw new MessagingException("403 The user does not have access to this API", context); - } - if (responseCode == 404) { - throw new MessagingException("404 Path not found", context); - } - if (responseCode == 415) { - throw new MessagingException("415 The content-type of the request is incorrect", - context); - } - if (responseCode == 429) { - throw new MessagingException("429 The rate limit has been reached", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - BandwidthMessage result = ApiHelper.deserialize(responseBody, - BandwidthMessage.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - -} diff --git a/src/main/java/com/bandwidth/messaging/exceptions/MessagingException.java b/src/main/java/com/bandwidth/messaging/exceptions/MessagingException.java deleted file mode 100644 index 971dbc65..00000000 --- a/src/main/java/com/bandwidth/messaging/exceptions/MessagingException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for MessagingException type. - */ -public class MessagingException - extends ApiException { - private static final long serialVersionUID = 3829971530321243789L; - private String type; - private String description; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public MessagingException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Type. - * @return Returns the String - */ - @JsonGetter("type") - public String getType() { - return this.type; - } - - /** - * Setter for Type. - * @param type Value for String - */ - @JsonSetter("type") - private void setType(String type) { - this.type = type; - } - - /** - * Getter for Description. - * @return Returns the String - */ - @JsonGetter("description") - public String getDescription() { - return this.description; - } - - /** - * Setter for Description. - * @param description Value for String - */ - @JsonSetter("description") - private void setDescription(String description) { - this.description = description; - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/BandwidthCallbackMessage.java b/src/main/java/com/bandwidth/messaging/models/BandwidthCallbackMessage.java deleted file mode 100644 index 24e14c55..00000000 --- a/src/main/java/com/bandwidth/messaging/models/BandwidthCallbackMessage.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for BandwidthCallbackMessage type. - */ -public class BandwidthCallbackMessage { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String time; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String type; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String errorCode; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String description; - @JsonInclude(JsonInclude.Include.NON_NULL) - private BandwidthMessage message; - - /** - * Default constructor. - */ - public BandwidthCallbackMessage() { - } - - /** - * Initialization constructor. - * @param time String value for time. - * @param type String value for type. - * @param to String value for to. - * @param errorCode String value for errorCode. - * @param description String value for description. - * @param message BandwidthMessage value for message. - */ - public BandwidthCallbackMessage( - String time, - String type, - String to, - String errorCode, - String description, - BandwidthMessage message) { - this.time = time; - this.type = type; - this.to = to; - this.errorCode = errorCode; - this.description = description; - this.message = message; - } - - /** - * Getter for Time. - * @return Returns the String - */ - @JsonGetter("time") - public String getTime() { - return time; - } - - /** - * Setter for Time. - * @param time Value for String - */ - @JsonSetter("time") - public void setTime(String time) { - this.time = time; - } - - /** - * Getter for Type. - * @return Returns the String - */ - @JsonGetter("type") - public String getType() { - return type; - } - - /** - * Setter for Type. - * @param type Value for String - */ - @JsonSetter("type") - public void setType(String type) { - this.type = type; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for ErrorCode. - * @return Returns the String - */ - @JsonGetter("errorCode") - public String getErrorCode() { - return errorCode; - } - - /** - * Setter for ErrorCode. - * @param errorCode Value for String - */ - @JsonSetter("errorCode") - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - /** - * Getter for Description. - * @return Returns the String - */ - @JsonGetter("description") - public String getDescription() { - return description; - } - - /** - * Setter for Description. - * @param description Value for String - */ - @JsonSetter("description") - public void setDescription(String description) { - this.description = description; - } - - /** - * Getter for Message. - * @return Returns the BandwidthMessage - */ - @JsonGetter("message") - public BandwidthMessage getMessage() { - return message; - } - - /** - * Setter for Message. - * @param message Value for BandwidthMessage - */ - @JsonSetter("message") - public void setMessage(BandwidthMessage message) { - this.message = message; - } - - /** - * Converts this BandwidthCallbackMessage into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "BandwidthCallbackMessage [" + "time=" + time + ", type=" + type + ", to=" + to - + ", errorCode=" + errorCode + ", description=" + description + ", message=" - + message + "]"; - } - - /** - * Builds a new {@link BandwidthCallbackMessage.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link BandwidthCallbackMessage.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .time(getTime()) - .type(getType()) - .to(getTo()) - .errorCode(getErrorCode()) - .description(getDescription()) - .message(getMessage()); - return builder; - } - - /** - * Class to build instances of {@link BandwidthCallbackMessage}. - */ - public static class Builder { - private String time; - private String type; - private String to; - private String errorCode; - private String description; - private BandwidthMessage message; - - - - /** - * Setter for time. - * @param time String value for time. - * @return Builder - */ - public Builder time(String time) { - this.time = time; - return this; - } - - /** - * Setter for type. - * @param type String value for type. - * @return Builder - */ - public Builder type(String type) { - this.type = type; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for errorCode. - * @param errorCode String value for errorCode. - * @return Builder - */ - public Builder errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Setter for description. - * @param description String value for description. - * @return Builder - */ - public Builder description(String description) { - this.description = description; - return this; - } - - /** - * Setter for message. - * @param message BandwidthMessage value for message. - * @return Builder - */ - public Builder message(BandwidthMessage message) { - this.message = message; - return this; - } - - /** - * Builds a new {@link BandwidthCallbackMessage} object using the set fields. - * @return {@link BandwidthCallbackMessage} - */ - public BandwidthCallbackMessage build() { - return new BandwidthCallbackMessage(time, type, to, errorCode, description, message); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/BandwidthMessage.java b/src/main/java/com/bandwidth/messaging/models/BandwidthMessage.java deleted file mode 100644 index 46a3bf1a..00000000 --- a/src/main/java/com/bandwidth/messaging/models/BandwidthMessage.java +++ /dev/null @@ -1,519 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for BandwidthMessage type. - */ -public class BandwidthMessage { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String owner; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String time; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer segmentCount; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String direction; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List media; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String text; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String priority; - - /** - * Default constructor. - */ - public BandwidthMessage() { - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param owner String value for owner. - * @param applicationId String value for applicationId. - * @param time String value for time. - * @param segmentCount Integer value for segmentCount. - * @param direction String value for direction. - * @param to List of String value for to. - * @param from String value for from. - * @param media List of String value for media. - * @param text String value for text. - * @param tag String value for tag. - * @param priority String value for priority. - */ - public BandwidthMessage( - String id, - String owner, - String applicationId, - String time, - Integer segmentCount, - String direction, - List to, - String from, - List media, - String text, - String tag, - String priority) { - this.id = id; - this.owner = owner; - this.applicationId = applicationId; - this.time = time; - this.segmentCount = segmentCount; - this.direction = direction; - this.to = to; - this.from = from; - this.media = media; - this.text = text; - this.tag = tag; - this.priority = priority; - } - - /** - * Getter for Id. - * The id of the message - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * The id of the message - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Getter for Owner. - * The Bandwidth phone number associated with the message - * @return Returns the String - */ - @JsonGetter("owner") - public String getOwner() { - return owner; - } - - /** - * Setter for Owner. - * The Bandwidth phone number associated with the message - * @param owner Value for String - */ - @JsonSetter("owner") - public void setOwner(String owner) { - this.owner = owner; - } - - /** - * Getter for ApplicationId. - * The application ID associated with the message - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * The application ID associated with the message - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for Time. - * The datetime stamp of the message in ISO 8601 - * @return Returns the String - */ - @JsonGetter("time") - public String getTime() { - return time; - } - - /** - * Setter for Time. - * The datetime stamp of the message in ISO 8601 - * @param time Value for String - */ - @JsonSetter("time") - public void setTime(String time) { - this.time = time; - } - - /** - * Getter for SegmentCount. - * The number of segments the original message from the user is broken into before sending over - * to carrier networks - * @return Returns the Integer - */ - @JsonGetter("segmentCount") - public Integer getSegmentCount() { - return segmentCount; - } - - /** - * Setter for SegmentCount. - * The number of segments the original message from the user is broken into before sending over - * to carrier networks - * @param segmentCount Value for Integer - */ - @JsonSetter("segmentCount") - public void setSegmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; - } - - /** - * Getter for Direction. - * The direction of the message relative to Bandwidth. Can be in or out - * @return Returns the String - */ - @JsonGetter("direction") - public String getDirection() { - return direction; - } - - /** - * Setter for Direction. - * The direction of the message relative to Bandwidth. Can be in or out - * @param direction Value for String - */ - @JsonSetter("direction") - public void setDirection(String direction) { - this.direction = direction; - } - - /** - * Getter for To. - * The phone number recipients of the message - * @return Returns the List of String - */ - @JsonGetter("to") - public List getTo() { - return to; - } - - /** - * Setter for To. - * The phone number recipients of the message - * @param to Value for List of String - */ - @JsonSetter("to") - public void setTo(List to) { - this.to = to; - } - - /** - * Getter for From. - * The phone number the message was sent from - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * The phone number the message was sent from - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for Media. - * The list of media URLs sent in the message. Including a `filename` field in the - * `Content-Disposition` header of the media linked with a URL will set the displayed file name. - * This is a best practice to ensure that your media has a readable file name. - * @return Returns the List of String - */ - @JsonGetter("media") - public List getMedia() { - return media; - } - - /** - * Setter for Media. - * The list of media URLs sent in the message. Including a `filename` field in the - * `Content-Disposition` header of the media linked with a URL will set the displayed file name. - * This is a best practice to ensure that your media has a readable file name. - * @param media Value for List of String - */ - @JsonSetter("media") - public void setMedia(List media) { - this.media = media; - } - - /** - * Getter for Text. - * The contents of the message - * @return Returns the String - */ - @JsonGetter("text") - public String getText() { - return text; - } - - /** - * Setter for Text. - * The contents of the message - * @param text Value for String - */ - @JsonSetter("text") - public void setText(String text) { - this.text = text; - } - - /** - * Getter for Tag. - * The custom string set by the user - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * The custom string set by the user - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Getter for Priority. - * The priority specified by the user - * @return Returns the String - */ - @JsonGetter("priority") - public String getPriority() { - return priority; - } - - /** - * Setter for Priority. - * The priority specified by the user - * @param priority Value for String - */ - @JsonSetter("priority") - public void setPriority(String priority) { - this.priority = priority; - } - - /** - * Converts this BandwidthMessage into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "BandwidthMessage [" + "id=" + id + ", owner=" + owner + ", applicationId=" - + applicationId + ", time=" + time + ", segmentCount=" + segmentCount - + ", direction=" + direction + ", to=" + to + ", from=" + from + ", media=" + media - + ", text=" + text + ", tag=" + tag + ", priority=" + priority + "]"; - } - - /** - * Builds a new {@link BandwidthMessage.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link BandwidthMessage.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .owner(getOwner()) - .applicationId(getApplicationId()) - .time(getTime()) - .segmentCount(getSegmentCount()) - .direction(getDirection()) - .to(getTo()) - .from(getFrom()) - .media(getMedia()) - .text(getText()) - .tag(getTag()) - .priority(getPriority()); - return builder; - } - - /** - * Class to build instances of {@link BandwidthMessage}. - */ - public static class Builder { - private String id; - private String owner; - private String applicationId; - private String time; - private Integer segmentCount; - private String direction; - private List to; - private String from; - private List media; - private String text; - private String tag; - private String priority; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for owner. - * @param owner String value for owner. - * @return Builder - */ - public Builder owner(String owner) { - this.owner = owner; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for time. - * @param time String value for time. - * @return Builder - */ - public Builder time(String time) { - this.time = time; - return this; - } - - /** - * Setter for segmentCount. - * @param segmentCount Integer value for segmentCount. - * @return Builder - */ - public Builder segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; - return this; - } - - /** - * Setter for direction. - * @param direction String value for direction. - * @return Builder - */ - public Builder direction(String direction) { - this.direction = direction; - return this; - } - - /** - * Setter for to. - * @param to List of String value for to. - * @return Builder - */ - public Builder to(List to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for media. - * @param media List of String value for media. - * @return Builder - */ - public Builder media(List media) { - this.media = media; - return this; - } - - /** - * Setter for text. - * @param text String value for text. - * @return Builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Setter for priority. - * @param priority String value for priority. - * @return Builder - */ - public Builder priority(String priority) { - this.priority = priority; - return this; - } - - /** - * Builds a new {@link BandwidthMessage} object using the set fields. - * @return {@link BandwidthMessage} - */ - public BandwidthMessage build() { - return new BandwidthMessage(id, owner, applicationId, time, segmentCount, direction, to, - from, media, text, tag, priority); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/BandwidthMessageItem.java b/src/main/java/com/bandwidth/messaging/models/BandwidthMessageItem.java deleted file mode 100644 index 2f09d5d1..00000000 --- a/src/main/java/com/bandwidth/messaging/models/BandwidthMessageItem.java +++ /dev/null @@ -1,666 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for BandwidthMessageItem type. - */ -public class BandwidthMessageItem { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String messageId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String sourceTn; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String destinationTn; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String messageStatus; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String messageDirection; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String messageType; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer segmentCount; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer errorCode; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String receiveTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String carrierName; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer messageSize; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer messageLength; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer attachmentCount; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer recipientCount; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String campaignClass; - - /** - * Default constructor. - */ - public BandwidthMessageItem() { - } - - /** - * Initialization constructor. - * @param messageId String value for messageId. - * @param accountId String value for accountId. - * @param sourceTn String value for sourceTn. - * @param destinationTn String value for destinationTn. - * @param messageStatus String value for messageStatus. - * @param messageDirection String value for messageDirection. - * @param messageType String value for messageType. - * @param segmentCount Integer value for segmentCount. - * @param errorCode Integer value for errorCode. - * @param receiveTime String value for receiveTime. - * @param carrierName String value for carrierName. - * @param messageSize Integer value for messageSize. - * @param messageLength Integer value for messageLength. - * @param attachmentCount Integer value for attachmentCount. - * @param recipientCount Integer value for recipientCount. - * @param campaignClass String value for campaignClass. - */ - public BandwidthMessageItem( - String messageId, - String accountId, - String sourceTn, - String destinationTn, - String messageStatus, - String messageDirection, - String messageType, - Integer segmentCount, - Integer errorCode, - String receiveTime, - String carrierName, - Integer messageSize, - Integer messageLength, - Integer attachmentCount, - Integer recipientCount, - String campaignClass) { - this.messageId = messageId; - this.accountId = accountId; - this.sourceTn = sourceTn; - this.destinationTn = destinationTn; - this.messageStatus = messageStatus; - this.messageDirection = messageDirection; - this.messageType = messageType; - this.segmentCount = segmentCount; - this.errorCode = errorCode; - this.receiveTime = receiveTime; - this.carrierName = carrierName; - this.messageSize = messageSize; - this.messageLength = messageLength; - this.attachmentCount = attachmentCount; - this.recipientCount = recipientCount; - this.campaignClass = campaignClass; - } - - /** - * Getter for MessageId. - * The message id - * @return Returns the String - */ - @JsonGetter("messageId") - public String getMessageId() { - return messageId; - } - - /** - * Setter for MessageId. - * The message id - * @param messageId Value for String - */ - @JsonSetter("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * Getter for AccountId. - * The account id of the message - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * The account id of the message - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for SourceTn. - * The source phone number of the message - * @return Returns the String - */ - @JsonGetter("sourceTn") - public String getSourceTn() { - return sourceTn; - } - - /** - * Setter for SourceTn. - * The source phone number of the message - * @param sourceTn Value for String - */ - @JsonSetter("sourceTn") - public void setSourceTn(String sourceTn) { - this.sourceTn = sourceTn; - } - - /** - * Getter for DestinationTn. - * The recipient phone number of the message - * @return Returns the String - */ - @JsonGetter("destinationTn") - public String getDestinationTn() { - return destinationTn; - } - - /** - * Setter for DestinationTn. - * The recipient phone number of the message - * @param destinationTn Value for String - */ - @JsonSetter("destinationTn") - public void setDestinationTn(String destinationTn) { - this.destinationTn = destinationTn; - } - - /** - * Getter for MessageStatus. - * The status of the message - * @return Returns the String - */ - @JsonGetter("messageStatus") - public String getMessageStatus() { - return messageStatus; - } - - /** - * Setter for MessageStatus. - * The status of the message - * @param messageStatus Value for String - */ - @JsonSetter("messageStatus") - public void setMessageStatus(String messageStatus) { - this.messageStatus = messageStatus; - } - - /** - * Getter for MessageDirection. - * The direction of the message relative to Bandwidth. INBOUND or OUTBOUND - * @return Returns the String - */ - @JsonGetter("messageDirection") - public String getMessageDirection() { - return messageDirection; - } - - /** - * Setter for MessageDirection. - * The direction of the message relative to Bandwidth. INBOUND or OUTBOUND - * @param messageDirection Value for String - */ - @JsonSetter("messageDirection") - public void setMessageDirection(String messageDirection) { - this.messageDirection = messageDirection; - } - - /** - * Getter for MessageType. - * The type of message. sms or mms - * @return Returns the String - */ - @JsonGetter("messageType") - public String getMessageType() { - return messageType; - } - - /** - * Setter for MessageType. - * The type of message. sms or mms - * @param messageType Value for String - */ - @JsonSetter("messageType") - public void setMessageType(String messageType) { - this.messageType = messageType; - } - - /** - * Getter for SegmentCount. - * The number of segments the message was sent as - * @return Returns the Integer - */ - @JsonGetter("segmentCount") - public Integer getSegmentCount() { - return segmentCount; - } - - /** - * Setter for SegmentCount. - * The number of segments the message was sent as - * @param segmentCount Value for Integer - */ - @JsonSetter("segmentCount") - public void setSegmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; - } - - /** - * Getter for ErrorCode. - * The numeric error code of the message - * @return Returns the Integer - */ - @JsonGetter("errorCode") - public Integer getErrorCode() { - return errorCode; - } - - /** - * Setter for ErrorCode. - * The numeric error code of the message - * @param errorCode Value for Integer - */ - @JsonSetter("errorCode") - public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - } - - /** - * Getter for ReceiveTime. - * The ISO 8601 datetime of the message - * @return Returns the String - */ - @JsonGetter("receiveTime") - public String getReceiveTime() { - return receiveTime; - } - - /** - * Setter for ReceiveTime. - * The ISO 8601 datetime of the message - * @param receiveTime Value for String - */ - @JsonSetter("receiveTime") - public void setReceiveTime(String receiveTime) { - this.receiveTime = receiveTime; - } - - /** - * Getter for CarrierName. - * The name of the carrier. Not currently supported for MMS, coming soon - * @return Returns the String - */ - @JsonGetter("carrierName") - public String getCarrierName() { - return carrierName; - } - - /** - * Setter for CarrierName. - * The name of the carrier. Not currently supported for MMS, coming soon - * @param carrierName Value for String - */ - @JsonSetter("carrierName") - public void setCarrierName(String carrierName) { - this.carrierName = carrierName; - } - - /** - * Getter for MessageSize. - * The size of the message including message content and headers - * @return Returns the Integer - */ - @JsonGetter("messageSize") - public Integer getMessageSize() { - return messageSize; - } - - /** - * Setter for MessageSize. - * The size of the message including message content and headers - * @param messageSize Value for Integer - */ - @JsonSetter("messageSize") - public void setMessageSize(Integer messageSize) { - this.messageSize = messageSize; - } - - /** - * Getter for MessageLength. - * The length of the message content - * @return Returns the Integer - */ - @JsonGetter("messageLength") - public Integer getMessageLength() { - return messageLength; - } - - /** - * Setter for MessageLength. - * The length of the message content - * @param messageLength Value for Integer - */ - @JsonSetter("messageLength") - public void setMessageLength(Integer messageLength) { - this.messageLength = messageLength; - } - - /** - * Getter for AttachmentCount. - * The number of attachments the message has - * @return Returns the Integer - */ - @JsonGetter("attachmentCount") - public Integer getAttachmentCount() { - return attachmentCount; - } - - /** - * Setter for AttachmentCount. - * The number of attachments the message has - * @param attachmentCount Value for Integer - */ - @JsonSetter("attachmentCount") - public void setAttachmentCount(Integer attachmentCount) { - this.attachmentCount = attachmentCount; - } - - /** - * Getter for RecipientCount. - * The number of recipients the message has - * @return Returns the Integer - */ - @JsonGetter("recipientCount") - public Integer getRecipientCount() { - return recipientCount; - } - - /** - * Setter for RecipientCount. - * The number of recipients the message has - * @param recipientCount Value for Integer - */ - @JsonSetter("recipientCount") - public void setRecipientCount(Integer recipientCount) { - this.recipientCount = recipientCount; - } - - /** - * Getter for CampaignClass. - * The campaign class of the message, if it has one - * @return Returns the String - */ - @JsonGetter("campaignClass") - public String getCampaignClass() { - return campaignClass; - } - - /** - * Setter for CampaignClass. - * The campaign class of the message, if it has one - * @param campaignClass Value for String - */ - @JsonSetter("campaignClass") - public void setCampaignClass(String campaignClass) { - this.campaignClass = campaignClass; - } - - /** - * Converts this BandwidthMessageItem into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "BandwidthMessageItem [" + "messageId=" + messageId + ", accountId=" + accountId - + ", sourceTn=" + sourceTn + ", destinationTn=" + destinationTn + ", messageStatus=" - + messageStatus + ", messageDirection=" + messageDirection + ", messageType=" - + messageType + ", segmentCount=" + segmentCount + ", errorCode=" + errorCode - + ", receiveTime=" + receiveTime + ", carrierName=" + carrierName + ", messageSize=" - + messageSize + ", messageLength=" + messageLength + ", attachmentCount=" - + attachmentCount + ", recipientCount=" + recipientCount + ", campaignClass=" - + campaignClass + "]"; - } - - /** - * Builds a new {@link BandwidthMessageItem.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link BandwidthMessageItem.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .messageId(getMessageId()) - .accountId(getAccountId()) - .sourceTn(getSourceTn()) - .destinationTn(getDestinationTn()) - .messageStatus(getMessageStatus()) - .messageDirection(getMessageDirection()) - .messageType(getMessageType()) - .segmentCount(getSegmentCount()) - .errorCode(getErrorCode()) - .receiveTime(getReceiveTime()) - .carrierName(getCarrierName()) - .messageSize(getMessageSize()) - .messageLength(getMessageLength()) - .attachmentCount(getAttachmentCount()) - .recipientCount(getRecipientCount()) - .campaignClass(getCampaignClass()); - return builder; - } - - /** - * Class to build instances of {@link BandwidthMessageItem}. - */ - public static class Builder { - private String messageId; - private String accountId; - private String sourceTn; - private String destinationTn; - private String messageStatus; - private String messageDirection; - private String messageType; - private Integer segmentCount; - private Integer errorCode; - private String receiveTime; - private String carrierName; - private Integer messageSize; - private Integer messageLength; - private Integer attachmentCount; - private Integer recipientCount; - private String campaignClass; - - - - /** - * Setter for messageId. - * @param messageId String value for messageId. - * @return Builder - */ - public Builder messageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for sourceTn. - * @param sourceTn String value for sourceTn. - * @return Builder - */ - public Builder sourceTn(String sourceTn) { - this.sourceTn = sourceTn; - return this; - } - - /** - * Setter for destinationTn. - * @param destinationTn String value for destinationTn. - * @return Builder - */ - public Builder destinationTn(String destinationTn) { - this.destinationTn = destinationTn; - return this; - } - - /** - * Setter for messageStatus. - * @param messageStatus String value for messageStatus. - * @return Builder - */ - public Builder messageStatus(String messageStatus) { - this.messageStatus = messageStatus; - return this; - } - - /** - * Setter for messageDirection. - * @param messageDirection String value for messageDirection. - * @return Builder - */ - public Builder messageDirection(String messageDirection) { - this.messageDirection = messageDirection; - return this; - } - - /** - * Setter for messageType. - * @param messageType String value for messageType. - * @return Builder - */ - public Builder messageType(String messageType) { - this.messageType = messageType; - return this; - } - - /** - * Setter for segmentCount. - * @param segmentCount Integer value for segmentCount. - * @return Builder - */ - public Builder segmentCount(Integer segmentCount) { - this.segmentCount = segmentCount; - return this; - } - - /** - * Setter for errorCode. - * @param errorCode Integer value for errorCode. - * @return Builder - */ - public Builder errorCode(Integer errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Setter for receiveTime. - * @param receiveTime String value for receiveTime. - * @return Builder - */ - public Builder receiveTime(String receiveTime) { - this.receiveTime = receiveTime; - return this; - } - - /** - * Setter for carrierName. - * @param carrierName String value for carrierName. - * @return Builder - */ - public Builder carrierName(String carrierName) { - this.carrierName = carrierName; - return this; - } - - /** - * Setter for messageSize. - * @param messageSize Integer value for messageSize. - * @return Builder - */ - public Builder messageSize(Integer messageSize) { - this.messageSize = messageSize; - return this; - } - - /** - * Setter for messageLength. - * @param messageLength Integer value for messageLength. - * @return Builder - */ - public Builder messageLength(Integer messageLength) { - this.messageLength = messageLength; - return this; - } - - /** - * Setter for attachmentCount. - * @param attachmentCount Integer value for attachmentCount. - * @return Builder - */ - public Builder attachmentCount(Integer attachmentCount) { - this.attachmentCount = attachmentCount; - return this; - } - - /** - * Setter for recipientCount. - * @param recipientCount Integer value for recipientCount. - * @return Builder - */ - public Builder recipientCount(Integer recipientCount) { - this.recipientCount = recipientCount; - return this; - } - - /** - * Setter for campaignClass. - * @param campaignClass String value for campaignClass. - * @return Builder - */ - public Builder campaignClass(String campaignClass) { - this.campaignClass = campaignClass; - return this; - } - - /** - * Builds a new {@link BandwidthMessageItem} object using the set fields. - * @return {@link BandwidthMessageItem} - */ - public BandwidthMessageItem build() { - return new BandwidthMessageItem(messageId, accountId, sourceTn, destinationTn, - messageStatus, messageDirection, messageType, segmentCount, errorCode, - receiveTime, carrierName, messageSize, messageLength, attachmentCount, - recipientCount, campaignClass); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/BandwidthMessagesList.java b/src/main/java/com/bandwidth/messaging/models/BandwidthMessagesList.java deleted file mode 100644 index aac69547..00000000 --- a/src/main/java/com/bandwidth/messaging/models/BandwidthMessagesList.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for BandwidthMessagesList type. - */ -public class BandwidthMessagesList { - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer totalCount; - @JsonInclude(JsonInclude.Include.NON_NULL) - private PageInfo pageInfo; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List messages; - - /** - * Default constructor. - */ - public BandwidthMessagesList() { - } - - /** - * Initialization constructor. - * @param totalCount Integer value for totalCount. - * @param pageInfo PageInfo value for pageInfo. - * @param messages List of BandwidthMessageItem value for messages. - */ - public BandwidthMessagesList( - Integer totalCount, - PageInfo pageInfo, - List messages) { - this.totalCount = totalCount; - this.pageInfo = pageInfo; - this.messages = messages; - } - - /** - * Getter for TotalCount. - * Total number of messages matched by the search - * @return Returns the Integer - */ - @JsonGetter("totalCount") - public Integer getTotalCount() { - return totalCount; - } - - /** - * Setter for TotalCount. - * Total number of messages matched by the search - * @param totalCount Value for Integer - */ - @JsonSetter("totalCount") - public void setTotalCount(Integer totalCount) { - this.totalCount = totalCount; - } - - /** - * Getter for PageInfo. - * @return Returns the PageInfo - */ - @JsonGetter("pageInfo") - public PageInfo getPageInfo() { - return pageInfo; - } - - /** - * Setter for PageInfo. - * @param pageInfo Value for PageInfo - */ - @JsonSetter("pageInfo") - public void setPageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; - } - - /** - * Getter for Messages. - * @return Returns the List of BandwidthMessageItem - */ - @JsonGetter("messages") - public List getMessages() { - return messages; - } - - /** - * Setter for Messages. - * @param messages Value for List of BandwidthMessageItem - */ - @JsonSetter("messages") - public void setMessages(List messages) { - this.messages = messages; - } - - /** - * Converts this BandwidthMessagesList into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "BandwidthMessagesList [" + "totalCount=" + totalCount + ", pageInfo=" + pageInfo - + ", messages=" + messages + "]"; - } - - /** - * Builds a new {@link BandwidthMessagesList.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link BandwidthMessagesList.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .totalCount(getTotalCount()) - .pageInfo(getPageInfo()) - .messages(getMessages()); - return builder; - } - - /** - * Class to build instances of {@link BandwidthMessagesList}. - */ - public static class Builder { - private Integer totalCount; - private PageInfo pageInfo; - private List messages; - - - - /** - * Setter for totalCount. - * @param totalCount Integer value for totalCount. - * @return Builder - */ - public Builder totalCount(Integer totalCount) { - this.totalCount = totalCount; - return this; - } - - /** - * Setter for pageInfo. - * @param pageInfo PageInfo value for pageInfo. - * @return Builder - */ - public Builder pageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; - return this; - } - - /** - * Setter for messages. - * @param messages List of BandwidthMessageItem value for messages. - * @return Builder - */ - public Builder messages(List messages) { - this.messages = messages; - return this; - } - - /** - * Builds a new {@link BandwidthMessagesList} object using the set fields. - * @return {@link BandwidthMessagesList} - */ - public BandwidthMessagesList build() { - return new BandwidthMessagesList(totalCount, pageInfo, messages); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/DeferredResult.java b/src/main/java/com/bandwidth/messaging/models/DeferredResult.java deleted file mode 100644 index 3b3634be..00000000 --- a/src/main/java/com/bandwidth/messaging/models/DeferredResult.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for DeferredResult type. - */ -public class DeferredResult { - @JsonInclude(JsonInclude.Include.NON_NULL) - private Object result; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Boolean setOrExpired; - - /** - * Default constructor. - */ - public DeferredResult() { - } - - /** - * Initialization constructor. - * @param result Object value for result. - * @param setOrExpired Boolean value for setOrExpired. - */ - public DeferredResult( - Object result, - Boolean setOrExpired) { - this.result = result; - this.setOrExpired = setOrExpired; - } - - /** - * Getter for Result. - * @return Returns the Object - */ - @JsonGetter("result") - public Object getResult() { - return result; - } - - /** - * Setter for Result. - * @param result Value for Object - */ - @JsonSetter("result") - public void setResult(Object result) { - this.result = result; - } - - /** - * Getter for SetOrExpired. - * @return Returns the Boolean - */ - @JsonGetter("setOrExpired") - public Boolean getSetOrExpired() { - return setOrExpired; - } - - /** - * Setter for SetOrExpired. - * @param setOrExpired Value for Boolean - */ - @JsonSetter("setOrExpired") - public void setSetOrExpired(Boolean setOrExpired) { - this.setOrExpired = setOrExpired; - } - - /** - * Converts this DeferredResult into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "DeferredResult [" + "result=" + result + ", setOrExpired=" + setOrExpired + "]"; - } - - /** - * Builds a new {@link DeferredResult.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link DeferredResult.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .result(getResult()) - .setOrExpired(getSetOrExpired()); - return builder; - } - - /** - * Class to build instances of {@link DeferredResult}. - */ - public static class Builder { - private Object result; - private Boolean setOrExpired; - - - - /** - * Setter for result. - * @param result Object value for result. - * @return Builder - */ - public Builder result(Object result) { - this.result = result; - return this; - } - - /** - * Setter for setOrExpired. - * @param setOrExpired Boolean value for setOrExpired. - * @return Builder - */ - public Builder setOrExpired(Boolean setOrExpired) { - this.setOrExpired = setOrExpired; - return this; - } - - /** - * Builds a new {@link DeferredResult} object using the set fields. - * @return {@link DeferredResult} - */ - public DeferredResult build() { - return new DeferredResult(result, setOrExpired); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/Media.java b/src/main/java/com/bandwidth/messaging/models/Media.java deleted file mode 100644 index 4ca1550c..00000000 --- a/src/main/java/com/bandwidth/messaging/models/Media.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Media type. - */ -public class Media { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String content; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer contentLength; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mediaName; - - /** - * Default constructor. - */ - public Media() { - } - - /** - * Initialization constructor. - * @param content String value for content. - * @param contentLength Integer value for contentLength. - * @param mediaName String value for mediaName. - */ - public Media( - String content, - Integer contentLength, - String mediaName) { - this.content = content; - this.contentLength = contentLength; - this.mediaName = mediaName; - } - - /** - * Getter for Content. - * @return Returns the String - */ - @JsonGetter("content") - public String getContent() { - return content; - } - - /** - * Setter for Content. - * @param content Value for String - */ - @JsonSetter("content") - public void setContent(String content) { - this.content = content; - } - - /** - * Getter for ContentLength. - * @return Returns the Integer - */ - @JsonGetter("contentLength") - public Integer getContentLength() { - return contentLength; - } - - /** - * Setter for ContentLength. - * @param contentLength Value for Integer - */ - @JsonSetter("contentLength") - public void setContentLength(Integer contentLength) { - this.contentLength = contentLength; - } - - /** - * Getter for MediaName. - * @return Returns the String - */ - @JsonGetter("mediaName") - public String getMediaName() { - return mediaName; - } - - /** - * Setter for MediaName. - * @param mediaName Value for String - */ - @JsonSetter("mediaName") - public void setMediaName(String mediaName) { - this.mediaName = mediaName; - } - - /** - * Converts this Media into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Media [" + "content=" + content + ", contentLength=" + contentLength - + ", mediaName=" + mediaName + "]"; - } - - /** - * Builds a new {@link Media.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Media.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .content(getContent()) - .contentLength(getContentLength()) - .mediaName(getMediaName()); - return builder; - } - - /** - * Class to build instances of {@link Media}. - */ - public static class Builder { - private String content; - private Integer contentLength; - private String mediaName; - - - - /** - * Setter for content. - * @param content String value for content. - * @return Builder - */ - public Builder content(String content) { - this.content = content; - return this; - } - - /** - * Setter for contentLength. - * @param contentLength Integer value for contentLength. - * @return Builder - */ - public Builder contentLength(Integer contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Setter for mediaName. - * @param mediaName String value for mediaName. - * @return Builder - */ - public Builder mediaName(String mediaName) { - this.mediaName = mediaName; - return this; - } - - /** - * Builds a new {@link Media} object using the set fields. - * @return {@link Media} - */ - public Media build() { - return new Media(content, contentLength, mediaName); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/MessageRequest.java b/src/main/java/com/bandwidth/messaging/models/MessageRequest.java deleted file mode 100644 index d5afb84e..00000000 --- a/src/main/java/com/bandwidth/messaging/models/MessageRequest.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for MessageRequest type. - */ -public class MessageRequest { - private String applicationId; - private List to; - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String text; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List media; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private PriorityEnum priority; - - /** - * Default constructor. - */ - public MessageRequest() { - } - - /** - * Initialization constructor. - * @param applicationId String value for applicationId. - * @param to List of String value for to. - * @param from String value for from. - * @param text String value for text. - * @param media List of String value for media. - * @param tag String value for tag. - * @param priority PriorityEnum value for priority. - */ - public MessageRequest( - String applicationId, - List to, - String from, - String text, - List media, - String tag, - PriorityEnum priority) { - this.applicationId = applicationId; - this.to = to; - this.from = from; - this.text = text; - this.media = media; - this.tag = tag; - this.priority = priority; - } - - /** - * Getter for ApplicationId. - * The ID of the Application your from number is associated with in the Bandwidth Phone Number - * Dashboard. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * The ID of the Application your from number is associated with in the Bandwidth Phone Number - * Dashboard. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for To. - * The phone number(s) the message should be sent to in E164 format - * @return Returns the List of String - */ - @JsonGetter("to") - public List getTo() { - return to; - } - - /** - * Setter for To. - * The phone number(s) the message should be sent to in E164 format - * @param to Value for List of String - */ - @JsonSetter("to") - public void setTo(List to) { - this.to = to; - } - - /** - * Getter for From. - * One of your telephone numbers the message should come from in E164 format - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * One of your telephone numbers the message should come from in E164 format - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for Text. - * The contents of the text message. Must be 2048 characters or less. - * @return Returns the String - */ - @JsonGetter("text") - public String getText() { - return text; - } - - /** - * Setter for Text. - * The contents of the text message. Must be 2048 characters or less. - * @param text Value for String - */ - @JsonSetter("text") - public void setText(String text) { - this.text = text; - } - - /** - * Getter for Media. - * A list of URLs to include as media attachments as part of the message. - * @return Returns the List of String - */ - @JsonGetter("media") - public List getMedia() { - return media; - } - - /** - * Setter for Media. - * A list of URLs to include as media attachments as part of the message. - * @param media Value for List of String - */ - @JsonSetter("media") - public void setMedia(List media) { - this.media = media; - } - - /** - * Getter for Tag. - * A custom string that will be included in callback events of the message. Max 1024 characters - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * A custom string that will be included in callback events of the message. Max 1024 characters - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Getter for Priority. - * The message's priority, currently for toll-free or short code SMS only. Messages with a - * priority value of `"high"` are given preference over your other traffic. - * @return Returns the PriorityEnum - */ - @JsonGetter("priority") - public PriorityEnum getPriority() { - return priority; - } - - /** - * Setter for Priority. - * The message's priority, currently for toll-free or short code SMS only. Messages with a - * priority value of `"high"` are given preference over your other traffic. - * @param priority Value for PriorityEnum - */ - @JsonSetter("priority") - public void setPriority(PriorityEnum priority) { - this.priority = priority; - } - - /** - * Converts this MessageRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "MessageRequest [" + "applicationId=" + applicationId + ", to=" + to + ", from=" - + from + ", text=" + text + ", media=" + media + ", tag=" + tag + ", priority=" - + priority + "]"; - } - - /** - * Builds a new {@link MessageRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link MessageRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(applicationId, to, from) - .text(getText()) - .media(getMedia()) - .tag(getTag()) - .priority(getPriority()); - return builder; - } - - /** - * Class to build instances of {@link MessageRequest}. - */ - public static class Builder { - private String applicationId; - private List to; - private String from; - private String text; - private List media; - private String tag; - private PriorityEnum priority; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param applicationId String value for applicationId. - * @param to List of String value for to. - * @param from String value for from. - */ - public Builder(String applicationId, List to, String from) { - this.applicationId = applicationId; - this.to = to; - this.from = from; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for to. - * @param to List of String value for to. - * @return Builder - */ - public Builder to(List to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for text. - * @param text String value for text. - * @return Builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Setter for media. - * @param media List of String value for media. - * @return Builder - */ - public Builder media(List media) { - this.media = media; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Setter for priority. - * @param priority PriorityEnum value for priority. - * @return Builder - */ - public Builder priority(PriorityEnum priority) { - this.priority = priority; - return this; - } - - /** - * Builds a new {@link MessageRequest} object using the set fields. - * @return {@link MessageRequest} - */ - public MessageRequest build() { - return new MessageRequest(applicationId, to, from, text, media, tag, priority); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/PageInfo.java b/src/main/java/com/bandwidth/messaging/models/PageInfo.java deleted file mode 100644 index 32a17762..00000000 --- a/src/main/java/com/bandwidth/messaging/models/PageInfo.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for PageInfo type. - */ -public class PageInfo { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String prevPage; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String nextPage; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String prevPageToken; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String nextPageToken; - - /** - * Default constructor. - */ - public PageInfo() { - } - - /** - * Initialization constructor. - * @param prevPage String value for prevPage. - * @param nextPage String value for nextPage. - * @param prevPageToken String value for prevPageToken. - * @param nextPageToken String value for nextPageToken. - */ - public PageInfo( - String prevPage, - String nextPage, - String prevPageToken, - String nextPageToken) { - this.prevPage = prevPage; - this.nextPage = nextPage; - this.prevPageToken = prevPageToken; - this.nextPageToken = nextPageToken; - } - - /** - * Getter for PrevPage. - * The link to the previous page for pagination - * @return Returns the String - */ - @JsonGetter("prevPage") - public String getPrevPage() { - return prevPage; - } - - /** - * Setter for PrevPage. - * The link to the previous page for pagination - * @param prevPage Value for String - */ - @JsonSetter("prevPage") - public void setPrevPage(String prevPage) { - this.prevPage = prevPage; - } - - /** - * Getter for NextPage. - * The link to the next page for pagination - * @return Returns the String - */ - @JsonGetter("nextPage") - public String getNextPage() { - return nextPage; - } - - /** - * Setter for NextPage. - * The link to the next page for pagination - * @param nextPage Value for String - */ - @JsonSetter("nextPage") - public void setNextPage(String nextPage) { - this.nextPage = nextPage; - } - - /** - * Getter for PrevPageToken. - * The isolated pagination token for the previous page - * @return Returns the String - */ - @JsonGetter("prevPageToken") - public String getPrevPageToken() { - return prevPageToken; - } - - /** - * Setter for PrevPageToken. - * The isolated pagination token for the previous page - * @param prevPageToken Value for String - */ - @JsonSetter("prevPageToken") - public void setPrevPageToken(String prevPageToken) { - this.prevPageToken = prevPageToken; - } - - /** - * Getter for NextPageToken. - * The isolated pagination token for the next page - * @return Returns the String - */ - @JsonGetter("nextPageToken") - public String getNextPageToken() { - return nextPageToken; - } - - /** - * Setter for NextPageToken. - * The isolated pagination token for the next page - * @param nextPageToken Value for String - */ - @JsonSetter("nextPageToken") - public void setNextPageToken(String nextPageToken) { - this.nextPageToken = nextPageToken; - } - - /** - * Converts this PageInfo into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "PageInfo [" + "prevPage=" + prevPage + ", nextPage=" + nextPage + ", prevPageToken=" - + prevPageToken + ", nextPageToken=" + nextPageToken + "]"; - } - - /** - * Builds a new {@link PageInfo.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link PageInfo.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .prevPage(getPrevPage()) - .nextPage(getNextPage()) - .prevPageToken(getPrevPageToken()) - .nextPageToken(getNextPageToken()); - return builder; - } - - /** - * Class to build instances of {@link PageInfo}. - */ - public static class Builder { - private String prevPage; - private String nextPage; - private String prevPageToken; - private String nextPageToken; - - - - /** - * Setter for prevPage. - * @param prevPage String value for prevPage. - * @return Builder - */ - public Builder prevPage(String prevPage) { - this.prevPage = prevPage; - return this; - } - - /** - * Setter for nextPage. - * @param nextPage String value for nextPage. - * @return Builder - */ - public Builder nextPage(String nextPage) { - this.nextPage = nextPage; - return this; - } - - /** - * Setter for prevPageToken. - * @param prevPageToken String value for prevPageToken. - * @return Builder - */ - public Builder prevPageToken(String prevPageToken) { - this.prevPageToken = prevPageToken; - return this; - } - - /** - * Setter for nextPageToken. - * @param nextPageToken String value for nextPageToken. - * @return Builder - */ - public Builder nextPageToken(String nextPageToken) { - this.nextPageToken = nextPageToken; - return this; - } - - /** - * Builds a new {@link PageInfo} object using the set fields. - * @return {@link PageInfo} - */ - public PageInfo build() { - return new PageInfo(prevPage, nextPage, prevPageToken, nextPageToken); - } - } -} diff --git a/src/main/java/com/bandwidth/messaging/models/PriorityEnum.java b/src/main/java/com/bandwidth/messaging/models/PriorityEnum.java deleted file mode 100644 index d4614277..00000000 --- a/src/main/java/com/bandwidth/messaging/models/PriorityEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * PriorityEnum to be used. - */ -public enum PriorityEnum { - ENUM_DEFAULT, - - HIGH; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - ENUM_DEFAULT.value = "default"; - HIGH.value = "high"; - - valueMap.put("default", ENUM_DEFAULT); - valueMap.put("high", HIGH); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static PriorityEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of PriorityEnum values to list of string values. - * @param toConvert The list of PriorityEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (PriorityEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/messaging/models/Tag.java b/src/main/java/com/bandwidth/messaging/models/Tag.java deleted file mode 100644 index 1f89fe66..00000000 --- a/src/main/java/com/bandwidth/messaging/models/Tag.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.messaging.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Tag type. - */ -public class Tag { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String key; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String value; - - /** - * Default constructor. - */ - public Tag() { - } - - /** - * Initialization constructor. - * @param key String value for key. - * @param value String value for value. - */ - public Tag( - String key, - String value) { - this.key = key; - this.value = value; - } - - /** - * Getter for Key. - * @return Returns the String - */ - @JsonGetter("key") - public String getKey() { - return key; - } - - /** - * Setter for Key. - * @param key Value for String - */ - @JsonSetter("key") - public void setKey(String key) { - this.key = key; - } - - /** - * Getter for Value. - * @return Returns the String - */ - @JsonGetter("value") - public String getValue() { - return value; - } - - /** - * Setter for Value. - * @param value Value for String - */ - @JsonSetter("value") - public void setValue(String value) { - this.value = value; - } - - /** - * Converts this Tag into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Tag [" + "key=" + key + ", value=" + value + "]"; - } - - /** - * Builds a new {@link Tag.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Tag.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .key(getKey()) - .value(getValue()); - return builder; - } - - /** - * Class to build instances of {@link Tag}. - */ - public static class Builder { - private String key; - private String value; - - - - /** - * Setter for key. - * @param key String value for key. - * @return Builder - */ - public Builder key(String key) { - this.key = key; - return this; - } - - /** - * Setter for value. - * @param value String value for value. - * @return Builder - */ - public Builder value(String value) { - this.value = value; - return this; - } - - /** - * Builds a new {@link Tag} object using the set fields. - * @return {@link Tag} - */ - public Tag build() { - return new Tag(key, value); - } - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/controllers/MFAController.java b/src/main/java/com/bandwidth/multifactorauth/controllers/MFAController.java deleted file mode 100644 index 8ce50ab4..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/controllers/MFAController.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.controllers; - -import com.bandwidth.ApiHelper; -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.Server; -import com.bandwidth.controllers.BaseController; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.Headers; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.multifactorauth.exceptions.ErrorWithRequestException; -import com.bandwidth.multifactorauth.exceptions.ForbiddenRequestException; -import com.bandwidth.multifactorauth.exceptions.UnauthorizedRequestException; -import com.bandwidth.multifactorauth.models.TwoFactorCodeRequestSchema; -import com.bandwidth.multifactorauth.models.TwoFactorMessagingResponse; -import com.bandwidth.multifactorauth.models.TwoFactorVerifyCodeResponse; -import com.bandwidth.multifactorauth.models.TwoFactorVerifyRequestSchema; -import com.bandwidth.multifactorauth.models.TwoFactorVoiceResponse; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * This class lists all the endpoints of the groups. - */ -public final class MFAController extends BaseController { - - /** - * Initializes the controller. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - */ - public MFAController(Configuration config, HttpClient httpClient, - Map authManagers) { - super(config, httpClient, authManagers); - } - - /** - * Initializes the controller with HTTPCallback. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - * @param httpCallback Callback to be called before and after the HTTP call. - */ - public MFAController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - super(config, httpClient, authManagers, httpCallback); - } - - /** - * Multi-Factor authentication with Bandwidth Voice services. Allows for a user to send an MFA - * code via a phone call. - * @param accountId Required parameter: Bandwidth Account ID with Voice service enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorVoiceResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createVoiceTwoFactor( - final String accountId, - final TwoFactorCodeRequestSchema body) throws ApiException, IOException { - HttpRequest request = buildCreateVoiceTwoFactorRequest(accountId, body); - authManagers.get("multiFactorAuth").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateVoiceTwoFactorResponse(context); - } - - /** - * Multi-Factor authentication with Bandwidth Voice services. Allows for a user to send an MFA - * code via a phone call. - * @param accountId Required parameter: Bandwidth Account ID with Voice service enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorVoiceResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createVoiceTwoFactorAsync( - final String accountId, - final TwoFactorCodeRequestSchema body) { - return makeHttpCallAsync(() -> buildCreateVoiceTwoFactorRequest(accountId, body), - req -> authManagers.get("multiFactorAuth").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateVoiceTwoFactorResponse(context)); - } - - /** - * Builds the HttpRequest object for createVoiceTwoFactor. - */ - private HttpRequest buildCreateVoiceTwoFactorRequest( - final String accountId, - final TwoFactorCodeRequestSchema body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MULTIFACTORAUTHDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/code/voice"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createVoiceTwoFactor. - * @return An object of type TwoFactorVoiceResponse - */ - private ApiResponse handleCreateVoiceTwoFactorResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ErrorWithRequestException( - "If there is any issue with values passed in by the user", context); - } - if (responseCode == 401) { - throw new UnauthorizedRequestException( - "Authentication is either incorrect or not present", context); - } - if (responseCode == 403) { - throw new ForbiddenRequestException( - "The user is not authorized to access this resource", context); - } - if (responseCode == 500) { - throw new ErrorWithRequestException("An internal server error occurred", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - TwoFactorVoiceResponse result = ApiHelper.deserialize(responseBody, - TwoFactorVoiceResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Multi-Factor authentication with Bandwidth Messaging services. Allows a user to send an MFA - * code via a text message (SMS). - * @param accountId Required parameter: Bandwidth Account ID with Messaging service enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorMessagingResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createMessagingTwoFactor( - final String accountId, - final TwoFactorCodeRequestSchema body) throws ApiException, IOException { - HttpRequest request = buildCreateMessagingTwoFactorRequest(accountId, body); - authManagers.get("multiFactorAuth").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateMessagingTwoFactorResponse(context); - } - - /** - * Multi-Factor authentication with Bandwidth Messaging services. Allows a user to send an MFA - * code via a text message (SMS). - * @param accountId Required parameter: Bandwidth Account ID with Messaging service enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorMessagingResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createMessagingTwoFactorAsync( - final String accountId, - final TwoFactorCodeRequestSchema body) { - return makeHttpCallAsync(() -> buildCreateMessagingTwoFactorRequest(accountId, body), - req -> authManagers.get("multiFactorAuth").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateMessagingTwoFactorResponse(context)); - } - - /** - * Builds the HttpRequest object for createMessagingTwoFactor. - */ - private HttpRequest buildCreateMessagingTwoFactorRequest( - final String accountId, - final TwoFactorCodeRequestSchema body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MULTIFACTORAUTHDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/code/messaging"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createMessagingTwoFactor. - * @return An object of type TwoFactorMessagingResponse - */ - private ApiResponse handleCreateMessagingTwoFactorResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ErrorWithRequestException( - "If there is any issue with values passed in by the user", context); - } - if (responseCode == 401) { - throw new UnauthorizedRequestException( - "Authentication is either incorrect or not present", context); - } - if (responseCode == 403) { - throw new ForbiddenRequestException( - "The user is not authorized to access this resource", context); - } - if (responseCode == 500) { - throw new ErrorWithRequestException("An internal server error occurred", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - TwoFactorMessagingResponse result = ApiHelper.deserialize(responseBody, - TwoFactorMessagingResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Allows a user to verify an MFA code. - * @param accountId Required parameter: Bandwidth Account ID with Two-Factor enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorVerifyCodeResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createVerifyTwoFactor( - final String accountId, - final TwoFactorVerifyRequestSchema body) throws ApiException, IOException { - HttpRequest request = buildCreateVerifyTwoFactorRequest(accountId, body); - authManagers.get("multiFactorAuth").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateVerifyTwoFactorResponse(context); - } - - /** - * Allows a user to verify an MFA code. - * @param accountId Required parameter: Bandwidth Account ID with Two-Factor enabled - * @param body Required parameter: Example: - * @return Returns the TwoFactorVerifyCodeResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createVerifyTwoFactorAsync( - final String accountId, - final TwoFactorVerifyRequestSchema body) { - return makeHttpCallAsync(() -> buildCreateVerifyTwoFactorRequest(accountId, body), - req -> authManagers.get("multiFactorAuth").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateVerifyTwoFactorResponse(context)); - } - - /** - * Builds the HttpRequest object for createVerifyTwoFactor. - */ - private HttpRequest buildCreateVerifyTwoFactorRequest( - final String accountId, - final TwoFactorVerifyRequestSchema body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.MULTIFACTORAUTHDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/code/verify"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createVerifyTwoFactor. - * @return An object of type TwoFactorVerifyCodeResponse - */ - private ApiResponse handleCreateVerifyTwoFactorResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ErrorWithRequestException( - "If there is any issue with values passed in by the user", context); - } - if (responseCode == 401) { - throw new UnauthorizedRequestException( - "Authentication is either incorrect or not present", context); - } - if (responseCode == 403) { - throw new ForbiddenRequestException( - "The user is not authorized to access this resource", context); - } - if (responseCode == 429) { - throw new ErrorWithRequestException( - "The user has made too many bad requests and is temporarily locked out", - context); - } - if (responseCode == 500) { - throw new ErrorWithRequestException("An internal server error occurred", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - TwoFactorVerifyCodeResponse result = ApiHelper.deserialize(responseBody, - TwoFactorVerifyCodeResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/multifactorauth/exceptions/ErrorWithRequestException.java b/src/main/java/com/bandwidth/multifactorauth/exceptions/ErrorWithRequestException.java deleted file mode 100644 index 6978e39d..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/exceptions/ErrorWithRequestException.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ErrorWithRequestException type. - */ -public class ErrorWithRequestException - extends ApiException { - private static final long serialVersionUID = -2207935819585830921L; - private String error; - private String requestId; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public ErrorWithRequestException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Error. - * An error message pertaining to what the issue could be - * @return Returns the String - */ - @JsonGetter("error") - public String getError() { - return this.error; - } - - /** - * Setter for Error. - * An error message pertaining to what the issue could be - * @param error Value for String - */ - @JsonSetter("error") - private void setError(String error) { - this.error = error; - } - - /** - * Getter for RequestId. - * The associated requestId from AWS - * @return Returns the String - */ - @JsonGetter("requestId") - public String getRequestId() { - return this.requestId; - } - - /** - * Setter for RequestId. - * The associated requestId from AWS - * @param requestId Value for String - */ - @JsonSetter("requestId") - private void setRequestId(String requestId) { - this.requestId = requestId; - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/exceptions/ForbiddenRequestException.java b/src/main/java/com/bandwidth/multifactorauth/exceptions/ForbiddenRequestException.java deleted file mode 100644 index c90167a8..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/exceptions/ForbiddenRequestException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ForbiddenRequestException type. - */ -public class ForbiddenRequestException - extends ApiException { - private static final long serialVersionUID = 41606914026773976L; - private String message; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public ForbiddenRequestException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Message. - * The message containing the reason behind the request being forbidden - * @return Returns the String - */ - @JsonGetter("Message") - public String getMessage() { - return this.message; - } - - /** - * Setter for Message. - * The message containing the reason behind the request being forbidden - * @param message Value for String - */ - @JsonSetter("Message") - private void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/exceptions/UnauthorizedRequestException.java b/src/main/java/com/bandwidth/multifactorauth/exceptions/UnauthorizedRequestException.java deleted file mode 100644 index fa745441..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/exceptions/UnauthorizedRequestException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for UnauthorizedRequestException type. - */ -public class UnauthorizedRequestException - extends ApiException { - private static final long serialVersionUID = -43402636942119755L; - private String message; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public UnauthorizedRequestException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Message. - * The message containing the reason behind the request being unauthorized - * @return Returns the String - */ - @JsonGetter("message") - public String getMessage() { - return this.message; - } - - /** - * Setter for Message. - * The message containing the reason behind the request being unauthorized - * @param message Value for String - */ - @JsonSetter("message") - private void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorCodeRequestSchema.java b/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorCodeRequestSchema.java deleted file mode 100644 index faedcf06..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorCodeRequestSchema.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TwoFactorCodeRequestSchema type. - */ -public class TwoFactorCodeRequestSchema { - private String to; - private String from; - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String scope; - private String message; - private double digits; - - /** - * Default constructor. - */ - public TwoFactorCodeRequestSchema() { - } - - /** - * Initialization constructor. - * @param to String value for to. - * @param from String value for from. - * @param applicationId String value for applicationId. - * @param message String value for message. - * @param digits double value for digits. - * @param scope String value for scope. - */ - public TwoFactorCodeRequestSchema( - String to, - String from, - String applicationId, - String message, - double digits, - String scope) { - this.to = to; - this.from = from; - this.applicationId = applicationId; - this.scope = scope; - this.message = message; - this.digits = digits; - } - - /** - * Getter for To. - * The phone number to send the 2fa code to. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * The phone number to send the 2fa code to. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for From. - * The application phone number, the sender of the 2fa code. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * The application phone number, the sender of the 2fa code. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for ApplicationId. - * The application unique ID, obtained from Bandwidth. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * The application unique ID, obtained from Bandwidth. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for Scope. - * An optional field to denote what scope or action the 2fa code is addressing. If not supplied, - * defaults to "2FA". - * @return Returns the String - */ - @JsonGetter("scope") - public String getScope() { - return scope; - } - - /** - * Setter for Scope. - * An optional field to denote what scope or action the 2fa code is addressing. If not supplied, - * defaults to "2FA". - * @param scope Value for String - */ - @JsonSetter("scope") - public void setScope(String scope) { - this.scope = scope; - } - - /** - * Getter for Message. - * The message format of the 2fa code. There are three values that the system will replace - * "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" and "{NAME} value template are optional, while - * "{CODE}" must be supplied. As the name would suggest, code will be replace with the actual - * 2fa code. Name is replaced with the application name, configured during provisioning of 2fa. - * The scope value is the same value sent during the call and partitioned by the server. - * @return Returns the String - */ - @JsonGetter("message") - public String getMessage() { - return message; - } - - /** - * Setter for Message. - * The message format of the 2fa code. There are three values that the system will replace - * "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" and "{NAME} value template are optional, while - * "{CODE}" must be supplied. As the name would suggest, code will be replace with the actual - * 2fa code. Name is replaced with the application name, configured during provisioning of 2fa. - * The scope value is the same value sent during the call and partitioned by the server. - * @param message Value for String - */ - @JsonSetter("message") - public void setMessage(String message) { - this.message = message; - } - - /** - * Getter for Digits. - * The number of digits for your 2fa code. The valid number ranges from 2 to 8, inclusively. - * @return Returns the double - */ - @JsonGetter("digits") - public double getDigits() { - return digits; - } - - /** - * Setter for Digits. - * The number of digits for your 2fa code. The valid number ranges from 2 to 8, inclusively. - * @param digits Value for double - */ - @JsonSetter("digits") - public void setDigits(double digits) { - this.digits = digits; - } - - /** - * Converts this TwoFactorCodeRequestSchema into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TwoFactorCodeRequestSchema [" + "to=" + to + ", from=" + from + ", applicationId=" - + applicationId + ", message=" + message + ", digits=" + digits + ", scope=" + scope - + "]"; - } - - /** - * Builds a new {@link TwoFactorCodeRequestSchema.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TwoFactorCodeRequestSchema.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(to, from, applicationId, message, digits) - .scope(getScope()); - return builder; - } - - /** - * Class to build instances of {@link TwoFactorCodeRequestSchema}. - */ - public static class Builder { - private String to; - private String from; - private String applicationId; - private String message; - private double digits; - private String scope; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param to String value for to. - * @param from String value for from. - * @param applicationId String value for applicationId. - * @param message String value for message. - * @param digits double value for digits. - */ - public Builder(String to, String from, String applicationId, String message, - double digits) { - this.to = to; - this.from = from; - this.applicationId = applicationId; - this.message = message; - this.digits = digits; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for message. - * @param message String value for message. - * @return Builder - */ - public Builder message(String message) { - this.message = message; - return this; - } - - /** - * Setter for digits. - * @param digits double value for digits. - * @return Builder - */ - public Builder digits(double digits) { - this.digits = digits; - return this; - } - - /** - * Setter for scope. - * @param scope String value for scope. - * @return Builder - */ - public Builder scope(String scope) { - this.scope = scope; - return this; - } - - /** - * Builds a new {@link TwoFactorCodeRequestSchema} object using the set fields. - * @return {@link TwoFactorCodeRequestSchema} - */ - public TwoFactorCodeRequestSchema build() { - return new TwoFactorCodeRequestSchema(to, from, applicationId, message, digits, scope); - } - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorMessagingResponse.java b/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorMessagingResponse.java deleted file mode 100644 index 75039d30..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorMessagingResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TwoFactorMessagingResponse type. - */ -public class TwoFactorMessagingResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String messageId; - - /** - * Default constructor. - */ - public TwoFactorMessagingResponse() { - } - - /** - * Initialization constructor. - * @param messageId String value for messageId. - */ - public TwoFactorMessagingResponse( - String messageId) { - this.messageId = messageId; - } - - /** - * Getter for MessageId. - * @return Returns the String - */ - @JsonGetter("messageId") - public String getMessageId() { - return messageId; - } - - /** - * Setter for MessageId. - * @param messageId Value for String - */ - @JsonSetter("messageId") - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - /** - * Converts this TwoFactorMessagingResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TwoFactorMessagingResponse [" + "messageId=" + messageId + "]"; - } - - /** - * Builds a new {@link TwoFactorMessagingResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TwoFactorMessagingResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .messageId(getMessageId()); - return builder; - } - - /** - * Class to build instances of {@link TwoFactorMessagingResponse}. - */ - public static class Builder { - private String messageId; - - - - /** - * Setter for messageId. - * @param messageId String value for messageId. - * @return Builder - */ - public Builder messageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Builds a new {@link TwoFactorMessagingResponse} object using the set fields. - * @return {@link TwoFactorMessagingResponse} - */ - public TwoFactorMessagingResponse build() { - return new TwoFactorMessagingResponse(messageId); - } - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyCodeResponse.java b/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyCodeResponse.java deleted file mode 100644 index ab934695..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyCodeResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TwoFactorVerifyCodeResponse type. - */ -public class TwoFactorVerifyCodeResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private Boolean valid; - - /** - * Default constructor. - */ - public TwoFactorVerifyCodeResponse() { - } - - /** - * Initialization constructor. - * @param valid Boolean value for valid. - */ - public TwoFactorVerifyCodeResponse( - Boolean valid) { - this.valid = valid; - } - - /** - * Getter for Valid. - * @return Returns the Boolean - */ - @JsonGetter("valid") - public Boolean getValid() { - return valid; - } - - /** - * Setter for Valid. - * @param valid Value for Boolean - */ - @JsonSetter("valid") - public void setValid(Boolean valid) { - this.valid = valid; - } - - /** - * Converts this TwoFactorVerifyCodeResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TwoFactorVerifyCodeResponse [" + "valid=" + valid + "]"; - } - - /** - * Builds a new {@link TwoFactorVerifyCodeResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TwoFactorVerifyCodeResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .valid(getValid()); - return builder; - } - - /** - * Class to build instances of {@link TwoFactorVerifyCodeResponse}. - */ - public static class Builder { - private Boolean valid; - - - - /** - * Setter for valid. - * @param valid Boolean value for valid. - * @return Builder - */ - public Builder valid(Boolean valid) { - this.valid = valid; - return this; - } - - /** - * Builds a new {@link TwoFactorVerifyCodeResponse} object using the set fields. - * @return {@link TwoFactorVerifyCodeResponse} - */ - public TwoFactorVerifyCodeResponse build() { - return new TwoFactorVerifyCodeResponse(valid); - } - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyRequestSchema.java b/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyRequestSchema.java deleted file mode 100644 index 114c4e94..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVerifyRequestSchema.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TwoFactorVerifyRequestSchema type. - */ -public class TwoFactorVerifyRequestSchema { - private String to; - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String scope; - private double expirationTimeInMinutes; - private String code; - - /** - * Default constructor. - */ - public TwoFactorVerifyRequestSchema() { - } - - /** - * Initialization constructor. - * @param to String value for to. - * @param applicationId String value for applicationId. - * @param expirationTimeInMinutes double value for expirationTimeInMinutes. - * @param code String value for code. - * @param scope String value for scope. - */ - public TwoFactorVerifyRequestSchema( - String to, - String applicationId, - double expirationTimeInMinutes, - String code, - String scope) { - this.to = to; - this.applicationId = applicationId; - this.scope = scope; - this.expirationTimeInMinutes = expirationTimeInMinutes; - this.code = code; - } - - /** - * Getter for To. - * The phone number to send the 2fa code to. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * The phone number to send the 2fa code to. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for ApplicationId. - * The application unique ID, obtained from Bandwidth. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * The application unique ID, obtained from Bandwidth. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for Scope. - * An optional field to denote what scope or action the 2fa code is addressing. If not supplied, - * defaults to "2FA". - * @return Returns the String - */ - @JsonGetter("scope") - public String getScope() { - return scope; - } - - /** - * Setter for Scope. - * An optional field to denote what scope or action the 2fa code is addressing. If not supplied, - * defaults to "2FA". - * @param scope Value for String - */ - @JsonSetter("scope") - public void setScope(String scope) { - this.scope = scope; - } - - /** - * Getter for ExpirationTimeInMinutes. - * The time period, in minutes, to validate the 2fa code. By setting this to 3 minutes, it will - * mean any code generated within the last 3 minutes are still valid. The valid range for - * expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. - * @return Returns the double - */ - @JsonGetter("expirationTimeInMinutes") - public double getExpirationTimeInMinutes() { - return expirationTimeInMinutes; - } - - /** - * Setter for ExpirationTimeInMinutes. - * The time period, in minutes, to validate the 2fa code. By setting this to 3 minutes, it will - * mean any code generated within the last 3 minutes are still valid. The valid range for - * expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. - * @param expirationTimeInMinutes Value for double - */ - @JsonSetter("expirationTimeInMinutes") - public void setExpirationTimeInMinutes(double expirationTimeInMinutes) { - this.expirationTimeInMinutes = expirationTimeInMinutes; - } - - /** - * Getter for Code. - * The generated 2fa code to check if valid - * @return Returns the String - */ - @JsonGetter("code") - public String getCode() { - return code; - } - - /** - * Setter for Code. - * The generated 2fa code to check if valid - * @param code Value for String - */ - @JsonSetter("code") - public void setCode(String code) { - this.code = code; - } - - /** - * Converts this TwoFactorVerifyRequestSchema into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TwoFactorVerifyRequestSchema [" + "to=" + to + ", applicationId=" + applicationId - + ", expirationTimeInMinutes=" + expirationTimeInMinutes + ", code=" + code - + ", scope=" + scope + "]"; - } - - /** - * Builds a new {@link TwoFactorVerifyRequestSchema.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TwoFactorVerifyRequestSchema.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(to, applicationId, expirationTimeInMinutes, code) - .scope(getScope()); - return builder; - } - - /** - * Class to build instances of {@link TwoFactorVerifyRequestSchema}. - */ - public static class Builder { - private String to; - private String applicationId; - private double expirationTimeInMinutes; - private String code; - private String scope; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param to String value for to. - * @param applicationId String value for applicationId. - * @param expirationTimeInMinutes double value for expirationTimeInMinutes. - * @param code String value for code. - */ - public Builder(String to, String applicationId, double expirationTimeInMinutes, - String code) { - this.to = to; - this.applicationId = applicationId; - this.expirationTimeInMinutes = expirationTimeInMinutes; - this.code = code; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for expirationTimeInMinutes. - * @param expirationTimeInMinutes double value for expirationTimeInMinutes. - * @return Builder - */ - public Builder expirationTimeInMinutes(double expirationTimeInMinutes) { - this.expirationTimeInMinutes = expirationTimeInMinutes; - return this; - } - - /** - * Setter for code. - * @param code String value for code. - * @return Builder - */ - public Builder code(String code) { - this.code = code; - return this; - } - - /** - * Setter for scope. - * @param scope String value for scope. - * @return Builder - */ - public Builder scope(String scope) { - this.scope = scope; - return this; - } - - /** - * Builds a new {@link TwoFactorVerifyRequestSchema} object using the set fields. - * @return {@link TwoFactorVerifyRequestSchema} - */ - public TwoFactorVerifyRequestSchema build() { - return new TwoFactorVerifyRequestSchema(to, applicationId, expirationTimeInMinutes, - code, scope); - } - } -} diff --git a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVoiceResponse.java b/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVoiceResponse.java deleted file mode 100644 index c83b261c..00000000 --- a/src/main/java/com/bandwidth/multifactorauth/models/TwoFactorVoiceResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.multifactorauth.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TwoFactorVoiceResponse type. - */ -public class TwoFactorVoiceResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - - /** - * Default constructor. - */ - public TwoFactorVoiceResponse() { - } - - /** - * Initialization constructor. - * @param callId String value for callId. - */ - public TwoFactorVoiceResponse( - String callId) { - this.callId = callId; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Converts this TwoFactorVoiceResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TwoFactorVoiceResponse [" + "callId=" + callId + "]"; - } - - /** - * Builds a new {@link TwoFactorVoiceResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TwoFactorVoiceResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .callId(getCallId()); - return builder; - } - - /** - * Class to build instances of {@link TwoFactorVoiceResponse}. - */ - public static class Builder { - private String callId; - - - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Builds a new {@link TwoFactorVoiceResponse} object using the set fields. - * @return {@link TwoFactorVoiceResponse} - */ - public TwoFactorVoiceResponse build() { - return new TwoFactorVoiceResponse(callId); - } - } -} diff --git a/src/main/java/com/bandwidth/phonenumberlookup/controllers/APIController.java b/src/main/java/com/bandwidth/phonenumberlookup/controllers/APIController.java deleted file mode 100644 index 7f6a7aa4..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/controllers/APIController.java +++ /dev/null @@ -1,1306 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.controllers; - -import com.bandwidth.ApiHelper; -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.Server; -import com.bandwidth.controllers.BaseController; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.Headers; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.phonenumberlookup.exceptions.AccountsTnlookup400ErrorException; -import com.bandwidth.phonenumberlookup.models.OrderRequest; -import com.bandwidth.phonenumberlookup.models.OrderResponse; -import com.bandwidth.phonenumberlookup.models.OrderStatus; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * This class lists all the endpoints of the groups. - */ -public final class APIController extends BaseController { - - /** - * Initializes the controller. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers) { - super(config, httpClient, authManagers); - } - - /** - * Initializes the controller with HTTPCallback. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - * @param httpCallback Callback to be called before and after the HTTP call. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - super(config, httpClient, authManagers, httpCallback); - } - - /** - * Create a TN Lookup Order. - * @param accountId Required parameter: The ID of the Bandwidth account that the user belongs - * to. - * @param body Required parameter: Example: - * @return Returns the OrderResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createLookupRequest( - final String accountId, - final OrderRequest body) throws ApiException, IOException { - HttpRequest request = buildCreateLookupRequestRequest(accountId, body); - authManagers.get("phoneNumberLookup").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateLookupRequestResponse(context); - } - - /** - * Create a TN Lookup Order. - * @param accountId Required parameter: The ID of the Bandwidth account that the user belongs - * to. - * @param body Required parameter: Example: - * @return Returns the OrderResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createLookupRequestAsync( - final String accountId, - final OrderRequest body) { - return makeHttpCallAsync(() -> buildCreateLookupRequestRequest(accountId, body), - req -> authManagers.get("phoneNumberLookup").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateLookupRequestResponse(context)); - } - - /** - * Builds the HttpRequest object for createLookupRequest. - */ - private HttpRequest buildCreateLookupRequestRequest( - final String accountId, - final OrderRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.PHONENUMBERLOOKUPDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/tnlookup"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createLookupRequest. - * @return An object of type OrderResponse - */ - private ApiResponse handleCreateLookupRequestResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new AccountsTnlookup400ErrorException( - "Bad Request. Ensure that your request payload is properly formatted and that the telephone numbers used are valid.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Unauthorized. Ensure that you are using the proper credentials for the environment you are accessing, your user has the proper role assigned to it, and that your Bandwidth account is enabled for TN Lookup access.", - context); - } - if (responseCode == 415) { - throw new ApiException( - "Invalid content-type. Ensure that your content-type header is set to application/json.", - context); - } - if (responseCode == 429) { - throw new ApiException( - "Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving this status code.", - context); - } - if (responseCode == 500) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 501) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 502) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 503) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 504) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 505) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 506) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 507) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 508) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 509) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 510) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 511) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 512) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 513) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 514) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 515) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 516) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 517) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 518) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 519) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 520) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 521) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 522) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 523) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 524) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 525) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 526) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 527) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 528) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 529) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 530) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 531) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 532) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 533) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 534) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 535) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 536) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 537) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 538) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 539) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 540) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 541) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 542) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 543) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 544) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 545) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 546) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 547) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 548) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 549) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 550) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 551) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 552) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 553) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 554) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 555) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 556) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 557) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 558) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 559) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 560) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 561) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 562) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 563) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 564) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 565) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 566) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 567) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 568) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 569) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 570) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 571) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 572) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 573) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 574) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 575) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 576) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 577) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 578) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 579) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 580) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 581) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 582) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 583) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 584) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 585) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 586) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 587) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 588) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 589) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 590) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 591) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 592) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 593) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 594) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 595) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 596) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 597) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 598) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 599) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - OrderResponse result = ApiHelper.deserialize(responseBody, - OrderResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Query an existing TN Lookup Order. - * @param accountId Required parameter: The ID of the Bandwidth account that the user belongs - * to. - * @param requestId Required parameter: Example: - * @return Returns the OrderStatus wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getLookupRequestStatus( - final String accountId, - final String requestId) throws ApiException, IOException { - HttpRequest request = buildGetLookupRequestStatusRequest(accountId, requestId); - authManagers.get("phoneNumberLookup").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetLookupRequestStatusResponse(context); - } - - /** - * Query an existing TN Lookup Order. - * @param accountId Required parameter: The ID of the Bandwidth account that the user belongs - * to. - * @param requestId Required parameter: Example: - * @return Returns the OrderStatus wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getLookupRequestStatusAsync( - final String accountId, - final String requestId) { - return makeHttpCallAsync(() -> buildGetLookupRequestStatusRequest(accountId, requestId), - req -> authManagers.get("phoneNumberLookup").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetLookupRequestStatusResponse(context)); - } - - /** - * Builds the HttpRequest object for getLookupRequestStatus. - */ - private HttpRequest buildGetLookupRequestStatusRequest( - final String accountId, - final String requestId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.PHONENUMBERLOOKUPDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/tnlookup/{requestId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("requestId", - new SimpleEntry(requestId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getLookupRequestStatus. - * @return An object of type OrderStatus - */ - private ApiResponse handleGetLookupRequestStatusResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiException( - "Bad Request. Ensure that you have set the requestId as a URL path parameter.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Unauthorized. Ensure that you are using the proper credentials for the environment you are accessing, your user has the proper role assigned to it, and that your Bandwidth account is enabled for TN Lookup access.", - context); - } - if (responseCode == 404) { - throw new ApiException( - "RequestId not found. Ensure that the requestId used in the URL path is valid and maps to a previous request that was submitted.", - context); - } - if (responseCode == 429) { - throw new ApiException( - "Too Many Requests. Reduce the amount of requests that you are sending in order to avoid receiving this status code.", - context); - } - if (responseCode == 500) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 501) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 502) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 503) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 504) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 505) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 506) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 507) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 508) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 509) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 510) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 511) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 512) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 513) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 514) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 515) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 516) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 517) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 518) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 519) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 520) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 521) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 522) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 523) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 524) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 525) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 526) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 527) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 528) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 529) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 530) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 531) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 532) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 533) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 534) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 535) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 536) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 537) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 538) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 539) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 540) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 541) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 542) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 543) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 544) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 545) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 546) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 547) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 548) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 549) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 550) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 551) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 552) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 553) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 554) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 555) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 556) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 557) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 558) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 559) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 560) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 561) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 562) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 563) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 564) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 565) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 566) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 567) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 568) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 569) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 570) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 571) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 572) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 573) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 574) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 575) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 576) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 577) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 578) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 579) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 580) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 581) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 582) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 583) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 584) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 585) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 586) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 587) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 588) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 589) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 590) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 591) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 592) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 593) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 594) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 595) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 596) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 597) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 598) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - if (responseCode == 599) { - throw new ApiException( - "Unexpected error. Please contact Bandwidth Support if your requests are receiving this status code for an extended period of time.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - OrderStatus result = ApiHelper.deserialize(responseBody, - OrderStatus.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/phonenumberlookup/exceptions/AccountsTnlookup400ErrorException.java b/src/main/java/com/bandwidth/phonenumberlookup/exceptions/AccountsTnlookup400ErrorException.java deleted file mode 100644 index fc0e2a47..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/exceptions/AccountsTnlookup400ErrorException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for AccountsTnlookup400ErrorException type. - */ -public class AccountsTnlookup400ErrorException - extends ApiException { - private static final long serialVersionUID = -8196860678854372L; - private String message; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public AccountsTnlookup400ErrorException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Message. - * A description of what validation error occurred. - * @return Returns the String - */ - @JsonGetter("message") - public String getMessage() { - return this.message; - } - - /** - * Setter for Message. - * A description of what validation error occurred. - * @param message Value for String - */ - @JsonSetter("message") - private void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderRequest.java b/src/main/java/com/bandwidth/phonenumberlookup/models/OrderRequest.java deleted file mode 100644 index 5d64d679..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderRequest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for OrderRequest type. - */ -public class OrderRequest { - @JsonInclude(JsonInclude.Include.NON_NULL) - private List tns; - - /** - * Default constructor. - */ - public OrderRequest() { - } - - /** - * Initialization constructor. - * @param tns List of String value for tns. - */ - public OrderRequest( - List tns) { - this.tns = tns; - } - - /** - * Getter for Tns. - * @return Returns the List of String - */ - @JsonGetter("tns") - public List getTns() { - return tns; - } - - /** - * Setter for Tns. - * @param tns Value for List of String - */ - @JsonSetter("tns") - public void setTns(List tns) { - this.tns = tns; - } - - /** - * Converts this OrderRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "OrderRequest [" + "tns=" + tns + "]"; - } - - /** - * Builds a new {@link OrderRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link OrderRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .tns(getTns()); - return builder; - } - - /** - * Class to build instances of {@link OrderRequest}. - */ - public static class Builder { - private List tns; - - - - /** - * Setter for tns. - * @param tns List of String value for tns. - * @return Builder - */ - public Builder tns(List tns) { - this.tns = tns; - return this; - } - - /** - * Builds a new {@link OrderRequest} object using the set fields. - * @return {@link OrderRequest} - */ - public OrderRequest build() { - return new OrderRequest(tns); - } - } -} diff --git a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderResponse.java b/src/main/java/com/bandwidth/phonenumberlookup/models/OrderResponse.java deleted file mode 100644 index d16ad457..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderResponse.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for OrderResponse type. - */ -public class OrderResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String requestId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - - /** - * Default constructor. - */ - public OrderResponse() { - } - - /** - * Initialization constructor. - * @param requestId String value for requestId. - * @param status String value for status. - */ - public OrderResponse( - String requestId, - String status) { - this.requestId = requestId; - this.status = status; - } - - /** - * Getter for RequestId. - * @return Returns the String - */ - @JsonGetter("requestId") - public String getRequestId() { - return requestId; - } - - /** - * Setter for RequestId. - * @param requestId Value for String - */ - @JsonSetter("requestId") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * Getter for Status. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Converts this OrderResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "OrderResponse [" + "requestId=" + requestId + ", status=" + status + "]"; - } - - /** - * Builds a new {@link OrderResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link OrderResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .requestId(getRequestId()) - .status(getStatus()); - return builder; - } - - /** - * Class to build instances of {@link OrderResponse}. - */ - public static class Builder { - private String requestId; - private String status; - - - - /** - * Setter for requestId. - * @param requestId String value for requestId. - * @return Builder - */ - public Builder requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Builds a new {@link OrderResponse} object using the set fields. - * @return {@link OrderResponse} - */ - public OrderResponse build() { - return new OrderResponse(requestId, status); - } - } -} diff --git a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderStatus.java b/src/main/java/com/bandwidth/phonenumberlookup/models/OrderStatus.java deleted file mode 100644 index e92d1142..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/models/OrderStatus.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for OrderStatus type. - */ -public class OrderStatus { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String requestId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List failedTelephoneNumbers; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List result; - - /** - * Default constructor. - */ - public OrderStatus() { - } - - /** - * Initialization constructor. - * @param requestId String value for requestId. - * @param status String value for status. - * @param failedTelephoneNumbers List of String value for failedTelephoneNumbers. - * @param result List of Result value for result. - */ - public OrderStatus( - String requestId, - String status, - List failedTelephoneNumbers, - List result) { - this.requestId = requestId; - this.status = status; - this.failedTelephoneNumbers = failedTelephoneNumbers; - this.result = result; - } - - /** - * Getter for RequestId. - * The requestId. - * @return Returns the String - */ - @JsonGetter("requestId") - public String getRequestId() { - return requestId; - } - - /** - * Setter for RequestId. - * The requestId. - * @param requestId Value for String - */ - @JsonSetter("requestId") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - /** - * Getter for Status. - * The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED). - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED). - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for FailedTelephoneNumbers. - * The telephone numbers whose lookup failed - * @return Returns the List of String - */ - @JsonGetter("failedTelephoneNumbers") - public List getFailedTelephoneNumbers() { - return failedTelephoneNumbers; - } - - /** - * Setter for FailedTelephoneNumbers. - * The telephone numbers whose lookup failed - * @param failedTelephoneNumbers Value for List of String - */ - @JsonSetter("failedTelephoneNumbers") - public void setFailedTelephoneNumbers(List failedTelephoneNumbers) { - this.failedTelephoneNumbers = failedTelephoneNumbers; - } - - /** - * Getter for Result. - * The carrier information results for the specified telephone number. - * @return Returns the List of Result - */ - @JsonGetter("result") - public List getResult() { - return result; - } - - /** - * Setter for Result. - * The carrier information results for the specified telephone number. - * @param result Value for List of Result - */ - @JsonSetter("result") - public void setResult(List result) { - this.result = result; - } - - /** - * Converts this OrderStatus into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "OrderStatus [" + "requestId=" + requestId + ", status=" + status - + ", failedTelephoneNumbers=" + failedTelephoneNumbers + ", result=" + result + "]"; - } - - /** - * Builds a new {@link OrderStatus.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link OrderStatus.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .requestId(getRequestId()) - .status(getStatus()) - .failedTelephoneNumbers(getFailedTelephoneNumbers()) - .result(getResult()); - return builder; - } - - /** - * Class to build instances of {@link OrderStatus}. - */ - public static class Builder { - private String requestId; - private String status; - private List failedTelephoneNumbers; - private List result; - - - - /** - * Setter for requestId. - * @param requestId String value for requestId. - * @return Builder - */ - public Builder requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for failedTelephoneNumbers. - * @param failedTelephoneNumbers List of String value for failedTelephoneNumbers. - * @return Builder - */ - public Builder failedTelephoneNumbers(List failedTelephoneNumbers) { - this.failedTelephoneNumbers = failedTelephoneNumbers; - return this; - } - - /** - * Setter for result. - * @param result List of Result value for result. - * @return Builder - */ - public Builder result(List result) { - this.result = result; - return this; - } - - /** - * Builds a new {@link OrderStatus} object using the set fields. - * @return {@link OrderStatus} - */ - public OrderStatus build() { - return new OrderStatus(requestId, status, failedTelephoneNumbers, result); - } - } -} diff --git a/src/main/java/com/bandwidth/phonenumberlookup/models/Result.java b/src/main/java/com/bandwidth/phonenumberlookup/models/Result.java deleted file mode 100644 index 6a6c8260..00000000 --- a/src/main/java/com/bandwidth/phonenumberlookup/models/Result.java +++ /dev/null @@ -1,402 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.phonenumberlookup.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Result type. - */ -public class Result { - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer responseCode; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String message; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String e164Format; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String formatted; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String country; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String lineType; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String lineProvider; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mobileCountryCode; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mobileNetworkCode; - - /** - * Default constructor. - */ - public Result() { - } - - /** - * Initialization constructor. - * @param responseCode Integer value for responseCode. - * @param message String value for message. - * @param e164Format String value for e164Format. - * @param formatted String value for formatted. - * @param country String value for country. - * @param lineType String value for lineType. - * @param lineProvider String value for lineProvider. - * @param mobileCountryCode String value for mobileCountryCode. - * @param mobileNetworkCode String value for mobileNetworkCode. - */ - public Result( - Integer responseCode, - String message, - String e164Format, - String formatted, - String country, - String lineType, - String lineProvider, - String mobileCountryCode, - String mobileNetworkCode) { - this.responseCode = responseCode; - this.message = message; - this.e164Format = e164Format; - this.formatted = formatted; - this.country = country; - this.lineType = lineType; - this.lineProvider = lineProvider; - this.mobileCountryCode = mobileCountryCode; - this.mobileNetworkCode = mobileNetworkCode; - } - - /** - * Getter for ResponseCode. - * Our vendor's response code. - * @return Returns the Integer - */ - @JsonGetter("Response Code") - public Integer getResponseCode() { - return responseCode; - } - - /** - * Setter for ResponseCode. - * Our vendor's response code. - * @param responseCode Value for Integer - */ - @JsonSetter("Response Code") - public void setResponseCode(Integer responseCode) { - this.responseCode = responseCode; - } - - /** - * Getter for Message. - * Message associated with the response code. - * @return Returns the String - */ - @JsonGetter("Message") - public String getMessage() { - return message; - } - - /** - * Setter for Message. - * Message associated with the response code. - * @param message Value for String - */ - @JsonSetter("Message") - public void setMessage(String message) { - this.message = message; - } - - /** - * Getter for E164Format. - * The telephone number in E.164 format. - * @return Returns the String - */ - @JsonGetter("E.164 Format") - public String getE164Format() { - return e164Format; - } - - /** - * Setter for E164Format. - * The telephone number in E.164 format. - * @param e164Format Value for String - */ - @JsonSetter("E.164 Format") - public void setE164Format(String e164Format) { - this.e164Format = e164Format; - } - - /** - * Getter for Formatted. - * The formatted version of the telephone number. - * @return Returns the String - */ - @JsonGetter("Formatted") - public String getFormatted() { - return formatted; - } - - /** - * Setter for Formatted. - * The formatted version of the telephone number. - * @param formatted Value for String - */ - @JsonSetter("Formatted") - public void setFormatted(String formatted) { - this.formatted = formatted; - } - - /** - * Getter for Country. - * The country of the telephone number. - * @return Returns the String - */ - @JsonGetter("Country") - public String getCountry() { - return country; - } - - /** - * Setter for Country. - * The country of the telephone number. - * @param country Value for String - */ - @JsonSetter("Country") - public void setCountry(String country) { - this.country = country; - } - - /** - * Getter for LineType. - * The line type of the telephone number. - * @return Returns the String - */ - @JsonGetter("Line Type") - public String getLineType() { - return lineType; - } - - /** - * Setter for LineType. - * The line type of the telephone number. - * @param lineType Value for String - */ - @JsonSetter("Line Type") - public void setLineType(String lineType) { - this.lineType = lineType; - } - - /** - * Getter for LineProvider. - * The service provider of the telephone number. - * @return Returns the String - */ - @JsonGetter("Line Provider") - public String getLineProvider() { - return lineProvider; - } - - /** - * Setter for LineProvider. - * The service provider of the telephone number. - * @param lineProvider Value for String - */ - @JsonSetter("Line Provider") - public void setLineProvider(String lineProvider) { - this.lineProvider = lineProvider; - } - - /** - * Getter for MobileCountryCode. - * The first half of the Home Network Identity (HNI). - * @return Returns the String - */ - @JsonGetter("Mobile Country Code") - public String getMobileCountryCode() { - return mobileCountryCode; - } - - /** - * Setter for MobileCountryCode. - * The first half of the Home Network Identity (HNI). - * @param mobileCountryCode Value for String - */ - @JsonSetter("Mobile Country Code") - public void setMobileCountryCode(String mobileCountryCode) { - this.mobileCountryCode = mobileCountryCode; - } - - /** - * Getter for MobileNetworkCode. - * The second half of the HNI. - * @return Returns the String - */ - @JsonGetter("Mobile Network Code") - public String getMobileNetworkCode() { - return mobileNetworkCode; - } - - /** - * Setter for MobileNetworkCode. - * The second half of the HNI. - * @param mobileNetworkCode Value for String - */ - @JsonSetter("Mobile Network Code") - public void setMobileNetworkCode(String mobileNetworkCode) { - this.mobileNetworkCode = mobileNetworkCode; - } - - /** - * Converts this Result into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Result [" + "responseCode=" + responseCode + ", message=" + message - + ", e164Format=" + e164Format + ", formatted=" + formatted + ", country=" + country - + ", lineType=" + lineType + ", lineProvider=" + lineProvider - + ", mobileCountryCode=" + mobileCountryCode + ", mobileNetworkCode=" - + mobileNetworkCode + "]"; - } - - /** - * Builds a new {@link Result.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Result.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .responseCode(getResponseCode()) - .message(getMessage()) - .e164Format(getE164Format()) - .formatted(getFormatted()) - .country(getCountry()) - .lineType(getLineType()) - .lineProvider(getLineProvider()) - .mobileCountryCode(getMobileCountryCode()) - .mobileNetworkCode(getMobileNetworkCode()); - return builder; - } - - /** - * Class to build instances of {@link Result}. - */ - public static class Builder { - private Integer responseCode; - private String message; - private String e164Format; - private String formatted; - private String country; - private String lineType; - private String lineProvider; - private String mobileCountryCode; - private String mobileNetworkCode; - - - - /** - * Setter for responseCode. - * @param responseCode Integer value for responseCode. - * @return Builder - */ - public Builder responseCode(Integer responseCode) { - this.responseCode = responseCode; - return this; - } - - /** - * Setter for message. - * @param message String value for message. - * @return Builder - */ - public Builder message(String message) { - this.message = message; - return this; - } - - /** - * Setter for e164Format. - * @param e164Format String value for e164Format. - * @return Builder - */ - public Builder e164Format(String e164Format) { - this.e164Format = e164Format; - return this; - } - - /** - * Setter for formatted. - * @param formatted String value for formatted. - * @return Builder - */ - public Builder formatted(String formatted) { - this.formatted = formatted; - return this; - } - - /** - * Setter for country. - * @param country String value for country. - * @return Builder - */ - public Builder country(String country) { - this.country = country; - return this; - } - - /** - * Setter for lineType. - * @param lineType String value for lineType. - * @return Builder - */ - public Builder lineType(String lineType) { - this.lineType = lineType; - return this; - } - - /** - * Setter for lineProvider. - * @param lineProvider String value for lineProvider. - * @return Builder - */ - public Builder lineProvider(String lineProvider) { - this.lineProvider = lineProvider; - return this; - } - - /** - * Setter for mobileCountryCode. - * @param mobileCountryCode String value for mobileCountryCode. - * @return Builder - */ - public Builder mobileCountryCode(String mobileCountryCode) { - this.mobileCountryCode = mobileCountryCode; - return this; - } - - /** - * Setter for mobileNetworkCode. - * @param mobileNetworkCode String value for mobileNetworkCode. - * @return Builder - */ - public Builder mobileNetworkCode(String mobileNetworkCode) { - this.mobileNetworkCode = mobileNetworkCode; - return this; - } - - /** - * Builds a new {@link Result} object using the set fields. - * @return {@link Result} - */ - public Result build() { - return new Result(responseCode, message, e164Format, formatted, country, lineType, - lineProvider, mobileCountryCode, mobileNetworkCode); - } - } -} diff --git a/src/main/java/com/bandwidth/sdk/ApiCallback.java b/src/main/java/com/bandwidth/sdk/ApiCallback.java new file mode 100644 index 00000000..0cc71174 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/src/main/java/com/bandwidth/sdk/ApiClient.java b/src/main/java/com/bandwidth/sdk/ApiClient.java new file mode 100644 index 00000000..7cce6ad1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ApiClient.java @@ -0,0 +1,1552 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.bandwidth.sdk.auth.Authentication; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.auth.HttpBearerAuth; +import com.bandwidth.sdk.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + private String basePath = "http://localhost"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "", + "No description provided", + new HashMap() + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + private boolean debugging = false; + private Map defaultHeaderMap = new HashMap(); + private Map defaultCookieMap = new HashMap(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("Basic", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("Basic", new HttpBasicAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/9.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g http://localhost + * @return An instance of OkHttpClient + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; + return this; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.bandwidth.sdk.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.bandwidth.sdk.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.bandwidth.sdk.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.bandwidth.sdk.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link com.bandwidth.sdk.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + public void setAccessToken(String accessToken) { + throw new RuntimeException("No OAuth2 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Set the User-Agent header's value (by adding to the default header map). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + return ""; + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters + String jsonStr = JSON.serialize(param); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + return params; + } + + /** + * Formats the specified collection path parameter to a string value. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws com.bandwidth.sdk.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. + */ + @SuppressWarnings("unchecked") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws com.bandwidth.sdk.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else { + throw new ApiException("Content type \"" + contentType + "\" is not supported"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws com.bandwidth.sdk.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws com.bandwidth.sdk.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. + * @throws com.bandwidth.sdk.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws com.bandwidth.sdk.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body + */ + public T handleResponse(Response response, Type returnType) throws ApiException { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * Build HTTP call with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws com.bandwidth.sdk.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + + return httpClient.newCall(request); + } + + /** + * Build an HTTP request with the given options. + * + * @param baseUrl The base URL + * @param path The sub-path of the HTTP URL + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws com.bandwidth.sdk.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams + List allQueryParams = new ArrayList(queryParams); + allQueryParams.addAll(collectionQueryParams); + + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + + // prepare HTTP request body + RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } + if (!HttpMethod.permitsRequestBody(method)) { + reqBody = null; + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + // update parameters with authentication settings + updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(url); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } + + if (queryParams != null && !queryParams.isEmpty()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws com.bandwidth.sdk.ApiException If fails to update the parameters + */ + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + + /** + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws com.bandwidth.sdk.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/src/main/java/com/bandwidth/sdk/ApiException.java b/src/main/java/com/bandwidth/sdk/ApiException.java new file mode 100644 index 00000000..363841fb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ApiException.java @@ -0,0 +1,165 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import java.util.Map; +import java.util.List; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ApiException extends Exception { + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + /** + *

Constructor for ApiException.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } +} diff --git a/src/main/java/com/bandwidth/sdk/ApiResponse.java b/src/main/java/com/bandwidth/sdk/ApiResponse.java new file mode 100644 index 00000000..611e1218 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/src/main/java/com/bandwidth/sdk/Configuration.java b/src/main/java/com/bandwidth/sdk/Configuration.java new file mode 100644 index 00000000..8e4ca9f0 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/Configuration.java @@ -0,0 +1,41 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Configuration { + public static final String VERSION = "9.0.0"; + + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/com/bandwidth/sdk/GzipRequestInterceptor.java b/src/main/java/com/bandwidth/sdk/GzipRequestInterceptor.java new file mode 100644 index 00000000..d33a34fd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/GzipRequestInterceptor.java @@ -0,0 +1,85 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java new file mode 100644 index 00000000..7dd1f987 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -0,0 +1,474 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.internal.bind.util.ISO8601Utils; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; +import java.util.Locale; +import java.util.Map; +import java.util.HashMap; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. + * + * @param classByDiscriminatorValue The map of discriminator values to Java classes. + * @param discriminatorValue The value of the OpenAPI discriminator in the input data. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.AccountStatistics.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.AnswerCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.BridgeCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.BridgeTargetCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CallRecordingMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CallState.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CodeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Conference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceCompletedCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceCreatedCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceMember.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceMemberExitCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceMemberJoinCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRecordingAvailableCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRecordingMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ConferenceRedirectCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateCall.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateCallResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateLookupResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.CreateMessageRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DeferredResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DisconnectCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Diversion.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.DtmfCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.FieldError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.GatherCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InboundMessageCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InboundMessageCallbackMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.InitiateCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.ListMessageItem.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.LookupStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MachineDetectionCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MachineDetectionConfiguration.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MachineDetectionResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Media.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Message.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageDeliveredCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageDeliveredCallbackMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageFailedCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageFailedCallbackMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageSendingCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessageSendingCallbackMessage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagesList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagingCodeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MessagingRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaForbiddenRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.MfaUnauthorizedRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.PageInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingAvailableCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RedirectCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.StirShaken.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Tag.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TnLookupRequestError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TranscribeRecording.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.Transcription.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TranscriptionAvailableCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TranscriptionList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TranscriptionMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TransferAnswerCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TransferCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.TransferDisconnectCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateCall.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateCallRecording.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateConference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.UpdateConferenceMember.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerifyCodeRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VerifyCodeResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VoiceApiError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.VoiceCodeResponse.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(String body, Type returnType) { + try { + if (isLenientOnJson) { + JsonReader jsonReader = new JsonReader(new StringReader(body)); + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(body, returnType); + } + } catch (JsonParseException e) { + // Fallback processing when failed to parse JSON form response body: + // return the response body string directly for the String return type; + if (returnType.equals(String.class)) { + return (T) body; + } else { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return new java.sql.Date(dateFormat.parse(date).getTime()); + } + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} diff --git a/src/main/java/com/bandwidth/sdk/Pair.java b/src/main/java/com/bandwidth/sdk/Pair.java new file mode 100644 index 00000000..6cb8a150 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/Pair.java @@ -0,0 +1,57 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/src/main/java/com/bandwidth/sdk/ProgressRequestBody.java b/src/main/java/com/bandwidth/sdk/ProgressRequestBody.java new file mode 100644 index 00000000..26d7bf60 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/src/main/java/com/bandwidth/sdk/ProgressResponseBody.java b/src/main/java/com/bandwidth/sdk/ProgressResponseBody.java new file mode 100644 index 00000000..cf7184b8 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/src/main/java/com/bandwidth/sdk/ServerConfiguration.java b/src/main/java/com/bandwidth/sdk/ServerConfiguration.java new file mode 100644 index 00000000..df9dc784 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ServerConfiguration.java @@ -0,0 +1,58 @@ +package com.bandwidth.sdk; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/com/bandwidth/sdk/ServerVariable.java b/src/main/java/com/bandwidth/sdk/ServerVariable.java new file mode 100644 index 00000000..675f9e28 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/ServerVariable.java @@ -0,0 +1,23 @@ +package com.bandwidth.sdk; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/com/bandwidth/sdk/StringUtil.java b/src/main/java/com/bandwidth/sdk/StringUtil.java new file mode 100644 index 00000000..813ca068 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/CallsApi.java b/src/main/java/com/bandwidth/sdk/api/CallsApi.java new file mode 100644 index 00000000..5de15cd7 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/CallsApi.java @@ -0,0 +1,759 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.CallState; +import com.bandwidth.sdk.model.CreateCall; +import com.bandwidth.sdk.model.CreateCallResponse; +import com.bandwidth.sdk.model.UpdateCall; +import com.bandwidth.sdk.model.VoiceApiError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CallsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public CallsApi() { + this(Configuration.getDefaultApiClient()); + } + + public CallsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createCall + * @param accountId Your Bandwidth Account ID. (required) + * @param createCall JSON object containing information to create an outbound call (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
201 Call Successfully Created * Location - The URL for further interactions with this call
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call createCallCall(String accountId, CreateCall createCall, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createCall; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createCallValidateBeforeCall(String accountId, CreateCall createCall, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling createCall(Async)"); + } + + // verify the required parameter 'createCall' is set + if (createCall == null) { + throw new ApiException("Missing the required parameter 'createCall' when calling createCall(Async)"); + } + + return createCallCall(accountId, createCall, _callback); + + } + + /** + * Create Call + * Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + * @param accountId Your Bandwidth Account ID. (required) + * @param createCall JSON object containing information to create an outbound call (required) + * @return CreateCallResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
201 Call Successfully Created * Location - The URL for further interactions with this call
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public CreateCallResponse createCall(String accountId, CreateCall createCall) throws ApiException { + ApiResponse localVarResp = createCallWithHttpInfo(accountId, createCall); + return localVarResp.getData(); + } + + /** + * Create Call + * Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + * @param accountId Your Bandwidth Account ID. (required) + * @param createCall JSON object containing information to create an outbound call (required) + * @return ApiResponse<CreateCallResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
201 Call Successfully Created * Location - The URL for further interactions with this call
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse createCallWithHttpInfo(String accountId, CreateCall createCall) throws ApiException { + okhttp3.Call localVarCall = createCallValidateBeforeCall(accountId, createCall, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Call (asynchronously) + * Creates an outbound phone call. All calls are initially queued. Your outbound calls will initiated at a specific dequeueing rate, enabling your application to \"fire and forget\" when creating calls. Queued calls may not be modified until they are dequeued and placed, but may be removed from your queue on demand. <b>Please note:</b> Calls submitted to your queue will be placed approximately in order, but exact ordering is not guaranteed. + * @param accountId Your Bandwidth Account ID. (required) + * @param createCall JSON object containing information to create an outbound call (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
201 Call Successfully Created * Location - The URL for further interactions with this call
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call createCallAsync(String accountId, CreateCall createCall, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createCallValidateBeforeCall(accountId, createCall, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCallState + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Call found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallStateCall(String accountId, String callId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCallStateValidateBeforeCall(String accountId, String callId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getCallState(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling getCallState(Async)"); + } + + return getCallStateCall(accountId, callId, _callback); + + } + + /** + * Get Call State Information + * Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @return CallState + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Call found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public CallState getCallState(String accountId, String callId) throws ApiException { + ApiResponse localVarResp = getCallStateWithHttpInfo(accountId, callId); + return localVarResp.getData(); + } + + /** + * Get Call State Information + * Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @return ApiResponse<CallState> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Call found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getCallStateWithHttpInfo(String accountId, String callId) throws ApiException { + okhttp3.Call localVarCall = getCallStateValidateBeforeCall(accountId, callId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Call State Information (asynchronously) + * Retrieve the current state of a specific call. This information is near-realtime, so it may take a few minutes for your call to be accessible using this endpoint. **Note**: Call information is kept for 7 days after the calls are hung up. If you attempt to retrieve information for a call that is older than 7 days, you will get an HTTP 404 response. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Call found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallStateAsync(String accountId, String callId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCallStateValidateBeforeCall(accountId, callId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateCall + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCall JSON object containing information to redirect an existing call to a new BXML document (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
200 Call was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallCall(String accountId, String callId, UpdateCall updateCall, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCall; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateCallValidateBeforeCall(String accountId, String callId, UpdateCall updateCall, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateCall(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling updateCall(Async)"); + } + + // verify the required parameter 'updateCall' is set + if (updateCall == null) { + throw new ApiException("Missing the required parameter 'updateCall' when calling updateCall(Async)"); + } + + return updateCallCall(accountId, callId, updateCall, _callback); + + } + + /** + * Update Call + * Interrupts and redirects a call to a different URL that should return a BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCall JSON object containing information to redirect an existing call to a new BXML document (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
200 Call was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateCall(String accountId, String callId, UpdateCall updateCall) throws ApiException { + updateCallWithHttpInfo(accountId, callId, updateCall); + } + + /** + * Update Call + * Interrupts and redirects a call to a different URL that should return a BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCall JSON object containing information to redirect an existing call to a new BXML document (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
200 Call was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateCallWithHttpInfo(String accountId, String callId, UpdateCall updateCall) throws ApiException { + okhttp3.Call localVarCall = updateCallValidateBeforeCall(accountId, callId, updateCall, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Call (asynchronously) + * Interrupts and redirects a call to a different URL that should return a BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCall JSON object containing information to redirect an existing call to a new BXML document (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
200 Call was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallAsync(String accountId, String callId, UpdateCall updateCall, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateCallValidateBeforeCall(accountId, callId, updateCall, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateCallBxml + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
204 Call BXML was successfully replaced. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallBxmlCall(String accountId, String callId, String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/bxml" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateCallBxmlValidateBeforeCall(String accountId, String callId, String body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateCallBxml(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling updateCallBxml(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateCallBxml(Async)"); + } + + return updateCallBxmlCall(accountId, callId, body, _callback); + + } + + /** + * Update Call BXML + * Interrupts and replaces an active call's BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
204 Call BXML was successfully replaced. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateCallBxml(String accountId, String callId, String body) throws ApiException { + updateCallBxmlWithHttpInfo(accountId, callId, body); + } + + /** + * Update Call BXML + * Interrupts and replaces an active call's BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
204 Call BXML was successfully replaced. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateCallBxmlWithHttpInfo(String accountId, String callId, String body) throws ApiException { + okhttp3.Call localVarCall = updateCallBxmlValidateBeforeCall(accountId, callId, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Call BXML (asynchronously) + * Interrupts and replaces an active call's BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + + +
Status Code Description Response Headers
204 Call BXML was successfully replaced. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
409 Conflict -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallBxmlAsync(String accountId, String callId, String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateCallBxmlValidateBeforeCall(accountId, callId, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/ConferencesApi.java b/src/main/java/com/bandwidth/sdk/api/ConferencesApi.java new file mode 100644 index 00000000..889d8630 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/ConferencesApi.java @@ -0,0 +1,1656 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.Conference; +import com.bandwidth.sdk.model.ConferenceMember; +import com.bandwidth.sdk.model.ConferenceRecordingMetadata; +import java.io.File; +import com.bandwidth.sdk.model.UpdateConference; +import com.bandwidth.sdk.model.UpdateConferenceMember; +import com.bandwidth.sdk.model.VoiceApiError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ConferencesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ConferencesApi() { + this(Configuration.getDefaultApiClient()); + } + + public ConferencesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for downloadConferenceRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call downloadConferenceRecordingCall(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "audio/vnd.wave", + "audio/mpeg", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call downloadConferenceRecordingValidateBeforeCall(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling downloadConferenceRecording(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling downloadConferenceRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling downloadConferenceRecording(Async)"); + } + + return downloadConferenceRecordingCall(accountId, conferenceId, recordingId, _callback); + + } + + /** + * Download Conference Recording + * Downloads the specified recording file. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public File downloadConferenceRecording(String accountId, String conferenceId, String recordingId) throws ApiException { + ApiResponse localVarResp = downloadConferenceRecordingWithHttpInfo(accountId, conferenceId, recordingId); + return localVarResp.getData(); + } + + /** + * Download Conference Recording + * Downloads the specified recording file. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse downloadConferenceRecordingWithHttpInfo(String accountId, String conferenceId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = downloadConferenceRecordingValidateBeforeCall(accountId, conferenceId, recordingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download Conference Recording (asynchronously) + * Downloads the specified recording file. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call downloadConferenceRecordingAsync(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = downloadConferenceRecordingValidateBeforeCall(accountId, conferenceId, recordingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getConference + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceCall(String accountId, String conferenceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getConferenceValidateBeforeCall(String accountId, String conferenceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getConference(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling getConference(Async)"); + } + + return getConferenceCall(accountId, conferenceId, _callback); + + } + + /** + * Get Conference Information + * Returns information about the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @return Conference + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public Conference getConference(String accountId, String conferenceId) throws ApiException { + ApiResponse localVarResp = getConferenceWithHttpInfo(accountId, conferenceId); + return localVarResp.getData(); + } + + /** + * Get Conference Information + * Returns information about the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @return ApiResponse<Conference> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getConferenceWithHttpInfo(String accountId, String conferenceId) throws ApiException { + okhttp3.Call localVarCall = getConferenceValidateBeforeCall(accountId, conferenceId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Conference Information (asynchronously) + * Returns information about the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceAsync(String accountId, String conferenceId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getConferenceValidateBeforeCall(accountId, conferenceId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getConferenceMember + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference member found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceMemberCall(String accountId, String conferenceId, String memberId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())) + .replace("{" + "memberId" + "}", localVarApiClient.escapeString(memberId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getConferenceMemberValidateBeforeCall(String accountId, String conferenceId, String memberId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getConferenceMember(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling getConferenceMember(Async)"); + } + + // verify the required parameter 'memberId' is set + if (memberId == null) { + throw new ApiException("Missing the required parameter 'memberId' when calling getConferenceMember(Async)"); + } + + return getConferenceMemberCall(accountId, conferenceId, memberId, _callback); + + } + + /** + * Get Conference Member + * Returns information about the specified conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @return ConferenceMember + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference member found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ConferenceMember getConferenceMember(String accountId, String conferenceId, String memberId) throws ApiException { + ApiResponse localVarResp = getConferenceMemberWithHttpInfo(accountId, conferenceId, memberId); + return localVarResp.getData(); + } + + /** + * Get Conference Member + * Returns information about the specified conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @return ApiResponse<ConferenceMember> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference member found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getConferenceMemberWithHttpInfo(String accountId, String conferenceId, String memberId) throws ApiException { + okhttp3.Call localVarCall = getConferenceMemberValidateBeforeCall(accountId, conferenceId, memberId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Conference Member (asynchronously) + * Returns information about the specified conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference member found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceMemberAsync(String accountId, String conferenceId, String memberId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getConferenceMemberValidateBeforeCall(accountId, conferenceId, memberId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getConferenceRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceRecordingCall(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getConferenceRecordingValidateBeforeCall(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getConferenceRecording(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling getConferenceRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling getConferenceRecording(Async)"); + } + + return getConferenceRecordingCall(accountId, conferenceId, recordingId, _callback); + + } + + /** + * Get Conference Recording Information + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ConferenceRecordingMetadata + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ConferenceRecordingMetadata getConferenceRecording(String accountId, String conferenceId, String recordingId) throws ApiException { + ApiResponse localVarResp = getConferenceRecordingWithHttpInfo(accountId, conferenceId, recordingId); + return localVarResp.getData(); + } + + /** + * Get Conference Recording Information + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<ConferenceRecordingMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getConferenceRecordingWithHttpInfo(String accountId, String conferenceId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = getConferenceRecordingValidateBeforeCall(accountId, conferenceId, recordingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Conference Recording Information (asynchronously) + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getConferenceRecordingAsync(String accountId, String conferenceId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getConferenceRecordingValidateBeforeCall(accountId, conferenceId, recordingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listConferenceRecordings + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listConferenceRecordingsCall(String accountId, String conferenceId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/recordings" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listConferenceRecordingsValidateBeforeCall(String accountId, String conferenceId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listConferenceRecordings(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling listConferenceRecordings(Async)"); + } + + return listConferenceRecordingsCall(accountId, conferenceId, _callback); + + } + + /** + * Get Conference Recordings + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @return List<ConferenceRecordingMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public List listConferenceRecordings(String accountId, String conferenceId) throws ApiException { + ApiResponse> localVarResp = listConferenceRecordingsWithHttpInfo(accountId, conferenceId); + return localVarResp.getData(); + } + + /** + * Get Conference Recordings + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @return ApiResponse<List<ConferenceRecordingMetadata>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse> listConferenceRecordingsWithHttpInfo(String accountId, String conferenceId) throws ApiException { + okhttp3.Call localVarCall = listConferenceRecordingsValidateBeforeCall(accountId, conferenceId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Conference Recordings (asynchronously) + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified conference. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conference recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listConferenceRecordingsAsync(String accountId, String conferenceId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listConferenceRecordingsValidateBeforeCall(accountId, conferenceId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listConferences + * @param accountId Your Bandwidth Account ID. (required) + * @param name Filter results by the `name` field. (optional) + * @param minCreatedTime Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param maxCreatedTime Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param pageSize Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param pageToken Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listConferencesCall(String accountId, String name, String minCreatedTime, String maxCreatedTime, Integer pageSize, String pageToken, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (name != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("name", name)); + } + + if (minCreatedTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("minCreatedTime", minCreatedTime)); + } + + if (maxCreatedTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("maxCreatedTime", maxCreatedTime)); + } + + if (pageSize != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); + } + + if (pageToken != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageToken", pageToken)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listConferencesValidateBeforeCall(String accountId, String name, String minCreatedTime, String maxCreatedTime, Integer pageSize, String pageToken, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listConferences(Async)"); + } + + return listConferencesCall(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken, _callback); + + } + + /** + * Get Conferences + * Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records. + * @param accountId Your Bandwidth Account ID. (required) + * @param name Filter results by the `name` field. (optional) + * @param minCreatedTime Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param maxCreatedTime Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param pageSize Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param pageToken Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional) + * @return List<Conference> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public List listConferences(String accountId, String name, String minCreatedTime, String maxCreatedTime, Integer pageSize, String pageToken) throws ApiException { + ApiResponse> localVarResp = listConferencesWithHttpInfo(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken); + return localVarResp.getData(); + } + + /** + * Get Conferences + * Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records. + * @param accountId Your Bandwidth Account ID. (required) + * @param name Filter results by the `name` field. (optional) + * @param minCreatedTime Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param maxCreatedTime Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param pageSize Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param pageToken Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional) + * @return ApiResponse<List<Conference>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse> listConferencesWithHttpInfo(String accountId, String name, String minCreatedTime, String maxCreatedTime, Integer pageSize, String pageToken) throws ApiException { + okhttp3.Call localVarCall = listConferencesValidateBeforeCall(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Conferences (asynchronously) + * Returns a max of 1000 conferences, sorted by `createdTime` from oldest to newest. **NOTE:** If the number of conferences in the account is bigger than `pageSize`, a `Link` header (with format `<{url}>; rel=\"next\"`) will be returned in the response. The url can be used to retrieve the next page of conference records. + * @param accountId Your Bandwidth Account ID. (required) + * @param name Filter results by the `name` field. (optional) + * @param minCreatedTime Filter results to conferences which have a `createdTime` after or at `minCreatedTime` (in ISO8601 format). (optional) + * @param maxCreatedTime Filter results to conferences which have a `createdTime` before or at `maxCreatedTime` (in ISO8601 format). (optional) + * @param pageSize Specifies the max number of conferences that will be returned. (optional, default to 1000) + * @param pageToken Not intended for explicit use. To use pagination, follow the links in the `Link` header of the response, as indicated in the endpoint description. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Conferences retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listConferencesAsync(String accountId, String name, String minCreatedTime, String maxCreatedTime, Integer pageSize, String pageToken, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listConferencesValidateBeforeCall(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateConference + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param updateConference (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceCall(String accountId, String conferenceId, UpdateConference updateConference, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateConference; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateConferenceValidateBeforeCall(String accountId, String conferenceId, UpdateConference updateConference, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateConference(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling updateConference(Async)"); + } + + // verify the required parameter 'updateConference' is set + if (updateConference == null) { + throw new ApiException("Missing the required parameter 'updateConference' when calling updateConference(Async)"); + } + + return updateConferenceCall(accountId, conferenceId, updateConference, _callback); + + } + + /** + * Update Conference + * Update the conference state. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param updateConference (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateConference(String accountId, String conferenceId, UpdateConference updateConference) throws ApiException { + updateConferenceWithHttpInfo(accountId, conferenceId, updateConference); + } + + /** + * Update Conference + * Update the conference state. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param updateConference (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateConferenceWithHttpInfo(String accountId, String conferenceId, UpdateConference updateConference) throws ApiException { + okhttp3.Call localVarCall = updateConferenceValidateBeforeCall(accountId, conferenceId, updateConference, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Conference (asynchronously) + * Update the conference state. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param updateConference (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceAsync(String accountId, String conferenceId, UpdateConference updateConference, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateConferenceValidateBeforeCall(accountId, conferenceId, updateConference, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateConferenceBxml + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param body (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceBxmlCall(String accountId, String conferenceId, String body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/bxml" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/xml" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateConferenceBxmlValidateBeforeCall(String accountId, String conferenceId, String body, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateConferenceBxml(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling updateConferenceBxml(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling updateConferenceBxml(Async)"); + } + + return updateConferenceBxmlCall(accountId, conferenceId, body, _callback); + + } + + /** + * Update Conference BXML + * Update the conference BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param body (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateConferenceBxml(String accountId, String conferenceId, String body) throws ApiException { + updateConferenceBxmlWithHttpInfo(accountId, conferenceId, body); + } + + /** + * Update Conference BXML + * Update the conference BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param body (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateConferenceBxmlWithHttpInfo(String accountId, String conferenceId, String body) throws ApiException { + okhttp3.Call localVarCall = updateConferenceBxmlValidateBeforeCall(accountId, conferenceId, body, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Conference BXML (asynchronously) + * Update the conference BXML document. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param body (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceBxmlAsync(String accountId, String conferenceId, String body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateConferenceBxmlValidateBeforeCall(accountId, conferenceId, body, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateConferenceMember + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param updateConferenceMember (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference member was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceMemberCall(String accountId, String conferenceId, String memberId, UpdateConferenceMember updateConferenceMember, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateConferenceMember; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "conferenceId" + "}", localVarApiClient.escapeString(conferenceId.toString())) + .replace("{" + "memberId" + "}", localVarApiClient.escapeString(memberId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateConferenceMemberValidateBeforeCall(String accountId, String conferenceId, String memberId, UpdateConferenceMember updateConferenceMember, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateConferenceMember(Async)"); + } + + // verify the required parameter 'conferenceId' is set + if (conferenceId == null) { + throw new ApiException("Missing the required parameter 'conferenceId' when calling updateConferenceMember(Async)"); + } + + // verify the required parameter 'memberId' is set + if (memberId == null) { + throw new ApiException("Missing the required parameter 'memberId' when calling updateConferenceMember(Async)"); + } + + // verify the required parameter 'updateConferenceMember' is set + if (updateConferenceMember == null) { + throw new ApiException("Missing the required parameter 'updateConferenceMember' when calling updateConferenceMember(Async)"); + } + + return updateConferenceMemberCall(accountId, conferenceId, memberId, updateConferenceMember, _callback); + + } + + /** + * Update Conference Member + * Updates settings for a particular conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param updateConferenceMember (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference member was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateConferenceMember(String accountId, String conferenceId, String memberId, UpdateConferenceMember updateConferenceMember) throws ApiException { + updateConferenceMemberWithHttpInfo(accountId, conferenceId, memberId, updateConferenceMember); + } + + /** + * Update Conference Member + * Updates settings for a particular conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param updateConferenceMember (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference member was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateConferenceMemberWithHttpInfo(String accountId, String conferenceId, String memberId, UpdateConferenceMember updateConferenceMember) throws ApiException { + okhttp3.Call localVarCall = updateConferenceMemberValidateBeforeCall(accountId, conferenceId, memberId, updateConferenceMember, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Conference Member (asynchronously) + * Updates settings for a particular conference member. + * @param accountId Your Bandwidth Account ID. (required) + * @param conferenceId Programmable Voice API Conference ID. (required) + * @param memberId Programmable Voice API Conference Member ID. (required) + * @param updateConferenceMember (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Conference member was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateConferenceMemberAsync(String accountId, String conferenceId, String memberId, UpdateConferenceMember updateConferenceMember, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateConferenceMemberValidateBeforeCall(accountId, conferenceId, memberId, updateConferenceMember, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/MediaApi.java b/src/main/java/com/bandwidth/sdk/api/MediaApi.java new file mode 100644 index 00000000..33b0008a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/MediaApi.java @@ -0,0 +1,797 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import java.io.File; +import com.bandwidth.sdk.model.Media; +import com.bandwidth.sdk.model.MessagingRequestError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MediaApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public MediaApi() { + this(Configuration.getDefaultApiClient()); + } + + public MediaApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteMedia + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteMediaCall(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{accountId}/media/{mediaId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "mediaId" + "}", localVarApiClient.escapeString(mediaId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteMediaValidateBeforeCall(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteMedia(Async)"); + } + + // verify the required parameter 'mediaId' is set + if (mediaId == null) { + throw new ApiException("Missing the required parameter 'mediaId' when calling deleteMedia(Async)"); + } + + return deleteMediaCall(accountId, mediaId, _callback); + + } + + /** + * Delete Media + * Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public void deleteMedia(String accountId, String mediaId) throws ApiException { + deleteMediaWithHttpInfo(accountId, mediaId); + } + + /** + * Delete Media + * Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse deleteMediaWithHttpInfo(String accountId, String mediaId) throws ApiException { + okhttp3.Call localVarCall = deleteMediaValidateBeforeCall(accountId, mediaId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Media (asynchronously) + * Deletes a media file from Bandwidth API server. Make sure you don't have any application scripts still using the media before you delete. If you accidentally delete a media file you can immediately upload a new file with the same name. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call deleteMediaAsync(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteMediaValidateBeforeCall(accountId, mediaId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for getMedia + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call getMediaCall(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{accountId}/media/{mediaId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "mediaId" + "}", localVarApiClient.escapeString(mediaId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getMediaValidateBeforeCall(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getMedia(Async)"); + } + + // verify the required parameter 'mediaId' is set + if (mediaId == null) { + throw new ApiException("Missing the required parameter 'mediaId' when calling getMedia(Async)"); + } + + return getMediaCall(accountId, mediaId, _callback); + + } + + /** + * Get Media + * Downloads a media file you previously uploaded. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public File getMedia(String accountId, String mediaId) throws ApiException { + ApiResponse localVarResp = getMediaWithHttpInfo(accountId, mediaId); + return localVarResp.getData(); + } + + /** + * Get Media + * Downloads a media file you previously uploaded. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse getMediaWithHttpInfo(String accountId, String mediaId) throws ApiException { + okhttp3.Call localVarCall = getMediaValidateBeforeCall(accountId, mediaId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Media (asynchronously) + * Downloads a media file you previously uploaded. + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call getMediaAsync(String accountId, String mediaId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getMediaValidateBeforeCall(accountId, mediaId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listMedia + * @param accountId Your Bandwidth Account ID. (required) + * @param continuationToken Continuation token used to retrieve subsequent media. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK * Continuation-Token - Continuation token used to retrieve subsequent media.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call listMediaCall(String accountId, String continuationToken, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{accountId}/media" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (continuationToken != null) { + localVarHeaderParams.put("Continuation-Token", localVarApiClient.parameterToString(continuationToken)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listMediaValidateBeforeCall(String accountId, String continuationToken, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listMedia(Async)"); + } + + return listMediaCall(accountId, continuationToken, _callback); + + } + + /** + * List Media + * Gets a list of your media files. No query parameters are supported. + * @param accountId Your Bandwidth Account ID. (required) + * @param continuationToken Continuation token used to retrieve subsequent media. (optional) + * @return List<Media> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK * Continuation-Token - Continuation token used to retrieve subsequent media.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public List listMedia(String accountId, String continuationToken) throws ApiException { + ApiResponse> localVarResp = listMediaWithHttpInfo(accountId, continuationToken); + return localVarResp.getData(); + } + + /** + * List Media + * Gets a list of your media files. No query parameters are supported. + * @param accountId Your Bandwidth Account ID. (required) + * @param continuationToken Continuation token used to retrieve subsequent media. (optional) + * @return ApiResponse<List<Media>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK * Continuation-Token - Continuation token used to retrieve subsequent media.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse> listMediaWithHttpInfo(String accountId, String continuationToken) throws ApiException { + okhttp3.Call localVarCall = listMediaValidateBeforeCall(accountId, continuationToken, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Media (asynchronously) + * Gets a list of your media files. No query parameters are supported. + * @param accountId Your Bandwidth Account ID. (required) + * @param continuationToken Continuation token used to retrieve subsequent media. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 OK * Continuation-Token - Continuation token used to retrieve subsequent media.
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call listMediaAsync(String accountId, String continuationToken, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listMediaValidateBeforeCall(accountId, continuationToken, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for uploadMedia + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param body (required) + * @param contentType The media type of the entity-body. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call uploadMediaCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/users/{accountId}/media/{mediaId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "mediaId" + "}", localVarApiClient.escapeString(mediaId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (contentType != null) { + localVarHeaderParams.put("Content-Type", localVarApiClient.parameterToString(contentType)); + } + + if (cacheControl != null) { + localVarHeaderParams.put("Cache-Control", localVarApiClient.parameterToString(cacheControl)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json", + "application/ogg", + "application/pdf", + "application/rtf", + "application/zip", + "application/x-tar", + "application/xml", + "application/gzip", + "application/x-bzip2", + "application/x-gzip", + "application/smil", + "application/javascript", + "audio/mp4", + "audio/mpeg", + "audio/ogg", + "audio/flac", + "audio/webm", + "audio/wav", + "audio/amr", + "audio/3gpp", + "image/bmp", + "image/gif", + "image/jpeg", + "image/pjpeg", + "image/png", + "image/svg+xml", + "image/tiff", + "image/webp", + "image/x-icon", + "text/css", + "text/csv", + "text/calendar", + "text/plain", + "text/javascript", + "text/vcard", + "text/vnd.wap.wml", + "text/xml", + "video/avi", + "video/mp4", + "video/mpeg", + "video/ogg", + "video/quicktime", + "video/webm", + "video/x-ms-wmv" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadMediaValidateBeforeCall(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling uploadMedia(Async)"); + } + + // verify the required parameter 'mediaId' is set + if (mediaId == null) { + throw new ApiException("Missing the required parameter 'mediaId' when calling uploadMedia(Async)"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling uploadMedia(Async)"); + } + + return uploadMediaCall(accountId, mediaId, body, contentType, cacheControl, _callback); + + } + + /** + * Upload Media + * Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param body (required) + * @param contentType The media type of the entity-body. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public void uploadMedia(String accountId, String mediaId, File body, String contentType, String cacheControl) throws ApiException { + uploadMediaWithHttpInfo(accountId, mediaId, body, contentType, cacheControl); + } + + /** + * Upload Media + * Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param body (required) + * @param contentType The media type of the entity-body. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse uploadMediaWithHttpInfo(String accountId, String mediaId, File body, String contentType, String cacheControl) throws ApiException { + okhttp3.Call localVarCall = uploadMediaValidateBeforeCall(accountId, mediaId, body, contentType, cacheControl, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Upload Media (asynchronously) + * Upload a file. You may add headers to the request in order to provide some control to your media file. If a file is uploaded with the same name as a file that already exists under this account, the previous file will be overwritten. A list of supported media types can be found [here](https://support.bandwidth.com/hc/en-us/articles/360014128994-What-MMS-file-types-are-supported-). + * @param accountId Your Bandwidth Account ID. (required) + * @param mediaId Media ID to retrieve. (required) + * @param body (required) + * @param contentType The media type of the entity-body. (optional) + * @param cacheControl General-header field is used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call uploadMediaAsync(String accountId, String mediaId, File body, String contentType, String cacheControl, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadMediaValidateBeforeCall(accountId, mediaId, body, contentType, cacheControl, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/MessagesApi.java b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java new file mode 100644 index 00000000..cf9c9914 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/MessagesApi.java @@ -0,0 +1,518 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.CreateMessageRequestError; +import com.bandwidth.sdk.model.ListMessageDirectionEnum; +import com.bandwidth.sdk.model.Message; +import com.bandwidth.sdk.model.MessageRequest; +import com.bandwidth.sdk.model.MessageStatusEnum; +import com.bandwidth.sdk.model.MessageTypeEnum; +import com.bandwidth.sdk.model.MessagesList; +import com.bandwidth.sdk.model.MessagingRequestError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MessagesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public MessagesApi() { + this(Configuration.getDefaultApiClient()); + } + + public MessagesApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createMessage + * @param accountId Your Bandwidth Account ID. (required) + * @param messageRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call createMessageCall(String accountId, MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = messageRequest; + + // create path and map variables + String localVarPath = "/users/{accountId}/messages" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createMessageValidateBeforeCall(String accountId, MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling createMessage(Async)"); + } + + // verify the required parameter 'messageRequest' is set + if (messageRequest == null) { + throw new ApiException("Missing the required parameter 'messageRequest' when calling createMessage(Async)"); + } + + return createMessageCall(accountId, messageRequest, _callback); + + } + + /** + * Create Message + * Endpoint for sending text messages and picture messages using V2 messaging. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageRequest (required) + * @return Message + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public Message createMessage(String accountId, MessageRequest messageRequest) throws ApiException { + ApiResponse localVarResp = createMessageWithHttpInfo(accountId, messageRequest); + return localVarResp.getData(); + } + + /** + * Create Message + * Endpoint for sending text messages and picture messages using V2 messaging. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageRequest (required) + * @return ApiResponse<Message> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse createMessageWithHttpInfo(String accountId, MessageRequest messageRequest) throws ApiException { + okhttp3.Call localVarCall = createMessageValidateBeforeCall(accountId, messageRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Message (asynchronously) + * Endpoint for sending text messages and picture messages using V2 messaging. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
406 Not Acceptable -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call createMessageAsync(String accountId, MessageRequest messageRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createMessageValidateBeforeCall(accountId, messageRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listMessages + * @param accountId Your Bandwidth Account ID. (required) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param messageType The type of message. Either sms or mms. (optional) + * @param errorCode The error code of the message. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param campaignId The campaign ID of the message. (optional) + * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param pageToken A base64 encoded value used for pagination of results. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call listMessagesCall(String accountId, String messageId, String sourceTn, String destinationTn, MessageStatusEnum messageStatus, ListMessageDirectionEnum messageDirection, String carrierName, MessageTypeEnum messageType, Integer errorCode, String fromDateTime, String toDateTime, String campaignId, String sort, String pageToken, Integer limit, Boolean limitTotalCount, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://messaging.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/users/{accountId}/messages" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (messageId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("messageId", messageId)); + } + + if (sourceTn != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sourceTn", sourceTn)); + } + + if (destinationTn != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("destinationTn", destinationTn)); + } + + if (messageStatus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("messageStatus", messageStatus)); + } + + if (messageDirection != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("messageDirection", messageDirection)); + } + + if (carrierName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("carrierName", carrierName)); + } + + if (messageType != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("messageType", messageType)); + } + + if (errorCode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("errorCode", errorCode)); + } + + if (fromDateTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fromDateTime", fromDateTime)); + } + + if (toDateTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("toDateTime", toDateTime)); + } + + if (campaignId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("campaignId", campaignId)); + } + + if (sort != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("sort", sort)); + } + + if (pageToken != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageToken", pageToken)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (limitTotalCount != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limitTotalCount", limitTotalCount)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listMessagesValidateBeforeCall(String accountId, String messageId, String sourceTn, String destinationTn, MessageStatusEnum messageStatus, ListMessageDirectionEnum messageDirection, String carrierName, MessageTypeEnum messageType, Integer errorCode, String fromDateTime, String toDateTime, String campaignId, String sort, String pageToken, Integer limit, Boolean limitTotalCount, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listMessages(Async)"); + } + + return listMessagesCall(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount, _callback); + + } + + /** + * List Messages + * Returns a list of messages based on query parameters. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param messageType The type of message. Either sms or mms. (optional) + * @param errorCode The error code of the message. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param campaignId The campaign ID of the message. (optional) + * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param pageToken A base64 encoded value used for pagination of results. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) + * @return MessagesList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public MessagesList listMessages(String accountId, String messageId, String sourceTn, String destinationTn, MessageStatusEnum messageStatus, ListMessageDirectionEnum messageDirection, String carrierName, MessageTypeEnum messageType, Integer errorCode, String fromDateTime, String toDateTime, String campaignId, String sort, String pageToken, Integer limit, Boolean limitTotalCount) throws ApiException { + ApiResponse localVarResp = listMessagesWithHttpInfo(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount); + return localVarResp.getData(); + } + + /** + * List Messages + * Returns a list of messages based on query parameters. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param messageType The type of message. Either sms or mms. (optional) + * @param errorCode The error code of the message. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param campaignId The campaign ID of the message. (optional) + * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param pageToken A base64 encoded value used for pagination of results. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) + * @return ApiResponse<MessagesList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse listMessagesWithHttpInfo(String accountId, String messageId, String sourceTn, String destinationTn, MessageStatusEnum messageStatus, ListMessageDirectionEnum messageDirection, String carrierName, MessageTypeEnum messageType, Integer errorCode, String fromDateTime, String toDateTime, String campaignId, String sort, String pageToken, Integer limit, Boolean limitTotalCount) throws ApiException { + okhttp3.Call localVarCall = listMessagesValidateBeforeCall(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Messages (asynchronously) + * Returns a list of messages based on query parameters. + * @param accountId Your Bandwidth Account ID. (required) + * @param messageId The ID of the message to search for. Special characters need to be encoded using URL encoding. Message IDs could come in different formats, e.g., 9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6 and 1589228074636lm4k2je7j7jklbn2 are valid message ID formats. Note that you must include at least one query parameter. (optional) + * @param sourceTn The phone number that sent the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param destinationTn The phone number that received the message. Accepted values are: a single full phone number a comma separated list of full phone numbers (maximum of 10) or a single partial phone number (minimum of 5 characters e.g. '%2B1919'). (optional) + * @param messageStatus The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. (optional) + * @param messageDirection The direction of the message. One of INBOUND OUTBOUND. (optional) + * @param carrierName The name of the carrier used for this message. Possible values include but are not limited to Verizon and TMobile. Special characters need to be encoded using URL encoding (i.e. AT&T should be passed as AT%26T). (optional) + * @param messageType The type of message. Either sms or mms. (optional) + * @param errorCode The error code of the message. (optional) + * @param fromDateTime The start of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param toDateTime The end of the date range to search in ISO 8601 format. Uses the message receive time. The date range to search in is currently 14 days. (optional) + * @param campaignId The campaign ID of the message. (optional) + * @param sort The field and direction to sort by combined with a colon. Direction is either asc or desc. (optional) + * @param pageToken A base64 encoded value used for pagination of results. (optional) + * @param limit The maximum records requested in search result. Default 100. The sum of limit and after cannot be more than 10000. (optional) + * @param limitTotalCount When set to true, the response's totalCount field will have a maximum value of 10,000. When set to false, or excluded, this will give an accurate totalCount of all messages that match the provided filters. If you are experiencing latency, try using this parameter to limit your results. (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call listMessagesAsync(String accountId, String messageId, String sourceTn, String destinationTn, MessageStatusEnum messageStatus, ListMessageDirectionEnum messageDirection, String carrierName, MessageTypeEnum messageType, Integer errorCode, String fromDateTime, String toDateTime, String campaignId, String sort, String pageToken, Integer limit, Boolean limitTotalCount, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = listMessagesValidateBeforeCall(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, limitTotalCount, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/MfaApi.java b/src/main/java/com/bandwidth/sdk/api/MfaApi.java new file mode 100644 index 00000000..20a0b22f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/MfaApi.java @@ -0,0 +1,533 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.CodeRequest; +import com.bandwidth.sdk.model.MessagingCodeResponse; +import com.bandwidth.sdk.model.MfaForbiddenRequestError; +import com.bandwidth.sdk.model.MfaRequestError; +import com.bandwidth.sdk.model.MfaUnauthorizedRequestError; +import com.bandwidth.sdk.model.VerifyCodeRequest; +import com.bandwidth.sdk.model.VerifyCodeResponse; +import com.bandwidth.sdk.model.VoiceCodeResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MfaApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public MfaApi() { + this(Configuration.getDefaultApiClient()); + } + + public MfaApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for generateMessagingCode + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public okhttp3.Call generateMessagingCodeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = codeRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/code/messaging" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generateMessagingCodeValidateBeforeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling generateMessagingCode(Async)"); + } + + // verify the required parameter 'codeRequest' is set + if (codeRequest == null) { + throw new ApiException("Missing the required parameter 'codeRequest' when calling generateMessagingCode(Async)"); + } + + return generateMessagingCodeCall(accountId, codeRequest, _callback); + + } + + /** + * Messaging Authentication Code + * Send an MFA code via text message (SMS). + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @return MessagingCodeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public MessagingCodeResponse generateMessagingCode(String accountId, CodeRequest codeRequest) throws ApiException { + ApiResponse localVarResp = generateMessagingCodeWithHttpInfo(accountId, codeRequest); + return localVarResp.getData(); + } + + /** + * Messaging Authentication Code + * Send an MFA code via text message (SMS). + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @return ApiResponse<MessagingCodeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public ApiResponse generateMessagingCodeWithHttpInfo(String accountId, CodeRequest codeRequest) throws ApiException { + okhttp3.Call localVarCall = generateMessagingCodeValidateBeforeCall(accountId, codeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Messaging Authentication Code (asynchronously) + * Send an MFA code via text message (SMS). + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public okhttp3.Call generateMessagingCodeAsync(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = generateMessagingCodeValidateBeforeCall(accountId, codeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for generateVoiceCode + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public okhttp3.Call generateVoiceCodeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = codeRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/code/voice" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call generateVoiceCodeValidateBeforeCall(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling generateVoiceCode(Async)"); + } + + // verify the required parameter 'codeRequest' is set + if (codeRequest == null) { + throw new ApiException("Missing the required parameter 'codeRequest' when calling generateVoiceCode(Async)"); + } + + return generateVoiceCodeCall(accountId, codeRequest, _callback); + + } + + /** + * Voice Authentication Code + * Send an MFA Code via a phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @return VoiceCodeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public VoiceCodeResponse generateVoiceCode(String accountId, CodeRequest codeRequest) throws ApiException { + ApiResponse localVarResp = generateVoiceCodeWithHttpInfo(accountId, codeRequest); + return localVarResp.getData(); + } + + /** + * Voice Authentication Code + * Send an MFA Code via a phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @return ApiResponse<VoiceCodeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public ApiResponse generateVoiceCodeWithHttpInfo(String accountId, CodeRequest codeRequest) throws ApiException { + okhttp3.Call localVarCall = generateVoiceCodeValidateBeforeCall(accountId, codeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Voice Authentication Code (asynchronously) + * Send an MFA Code via a phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param codeRequest MFA code request body. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
500 Internal Server Error -
+ */ + public okhttp3.Call generateVoiceCodeAsync(String accountId, CodeRequest codeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = generateVoiceCodeValidateBeforeCall(accountId, codeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for verifyCode + * @param accountId Your Bandwidth Account ID. (required) + * @param verifyCodeRequest MFA code verify request body. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call verifyCodeCall(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://mfa.bandwidth.com/api/v1" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = verifyCodeRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/code/verify" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call verifyCodeValidateBeforeCall(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling verifyCode(Async)"); + } + + // verify the required parameter 'verifyCodeRequest' is set + if (verifyCodeRequest == null) { + throw new ApiException("Missing the required parameter 'verifyCodeRequest' when calling verifyCode(Async)"); + } + + return verifyCodeCall(accountId, verifyCodeRequest, _callback); + + } + + /** + * Verify Authentication Code + * Verify a previously sent MFA code. + * @param accountId Your Bandwidth Account ID. (required) + * @param verifyCodeRequest MFA code verify request body. (required) + * @return VerifyCodeResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public VerifyCodeResponse verifyCode(String accountId, VerifyCodeRequest verifyCodeRequest) throws ApiException { + ApiResponse localVarResp = verifyCodeWithHttpInfo(accountId, verifyCodeRequest); + return localVarResp.getData(); + } + + /** + * Verify Authentication Code + * Verify a previously sent MFA code. + * @param accountId Your Bandwidth Account ID. (required) + * @param verifyCodeRequest MFA code verify request body. (required) + * @return ApiResponse<VerifyCodeResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse verifyCodeWithHttpInfo(String accountId, VerifyCodeRequest verifyCodeRequest) throws ApiException { + okhttp3.Call localVarCall = verifyCodeValidateBeforeCall(accountId, verifyCodeRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Verify Authentication Code (asynchronously) + * Verify a previously sent MFA code. + * @param accountId Your Bandwidth Account ID. (required) + * @param verifyCodeRequest MFA code verify request body. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call verifyCodeAsync(String accountId, VerifyCodeRequest verifyCodeRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = verifyCodeValidateBeforeCall(accountId, verifyCodeRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java b/src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java new file mode 100644 index 00000000..36eec73b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/PhoneNumberLookupApi.java @@ -0,0 +1,392 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.CreateLookupResponse; +import com.bandwidth.sdk.model.LookupRequest; +import com.bandwidth.sdk.model.LookupStatus; +import com.bandwidth.sdk.model.TnLookupRequestError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class PhoneNumberLookupApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PhoneNumberLookupApi() { + this(Configuration.getDefaultApiClient()); + } + + public PhoneNumberLookupApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for createLookup + * @param accountId Your Bandwidth Account ID. (required) + * @param lookupRequest Phone number lookup request. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call createLookupCall(String accountId, LookupRequest lookupRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://numbers.bandwidth.com/api/v1" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = lookupRequest; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tnlookup" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createLookupValidateBeforeCall(String accountId, LookupRequest lookupRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling createLookup(Async)"); + } + + // verify the required parameter 'lookupRequest' is set + if (lookupRequest == null) { + throw new ApiException("Missing the required parameter 'lookupRequest' when calling createLookup(Async)"); + } + + return createLookupCall(accountId, lookupRequest, _callback); + + } + + /** + * Create Lookup + * Create a Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param lookupRequest Phone number lookup request. (required) + * @return CreateLookupResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public CreateLookupResponse createLookup(String accountId, LookupRequest lookupRequest) throws ApiException { + ApiResponse localVarResp = createLookupWithHttpInfo(accountId, lookupRequest); + return localVarResp.getData(); + } + + /** + * Create Lookup + * Create a Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param lookupRequest Phone number lookup request. (required) + * @return ApiResponse<CreateLookupResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse createLookupWithHttpInfo(String accountId, LookupRequest lookupRequest) throws ApiException { + okhttp3.Call localVarCall = createLookupValidateBeforeCall(accountId, lookupRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create Lookup (asynchronously) + * Create a Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param lookupRequest Phone number lookup request. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
202 Accepted -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
415 Unsupported Media Type -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call createLookupAsync(String accountId, LookupRequest lookupRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createLookupValidateBeforeCall(accountId, lookupRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getLookupStatus + * @param accountId Your Bandwidth Account ID. (required) + * @param requestId The phone number lookup request ID from Bandwidth. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call getLookupStatusCall(String accountId, String requestId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://numbers.bandwidth.com/api/v1" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/tnlookup/{requestId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "requestId" + "}", localVarApiClient.escapeString(requestId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getLookupStatusValidateBeforeCall(String accountId, String requestId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getLookupStatus(Async)"); + } + + // verify the required parameter 'requestId' is set + if (requestId == null) { + throw new ApiException("Missing the required parameter 'requestId' when calling getLookupStatus(Async)"); + } + + return getLookupStatusCall(accountId, requestId, _callback); + + } + + /** + * Get Lookup Request Status + * Get an existing Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param requestId The phone number lookup request ID from Bandwidth. (required) + * @return LookupStatus + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public LookupStatus getLookupStatus(String accountId, String requestId) throws ApiException { + ApiResponse localVarResp = getLookupStatusWithHttpInfo(accountId, requestId); + return localVarResp.getData(); + } + + /** + * Get Lookup Request Status + * Get an existing Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param requestId The phone number lookup request ID from Bandwidth. (required) + * @return ApiResponse<LookupStatus> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public ApiResponse getLookupStatusWithHttpInfo(String accountId, String requestId) throws ApiException { + okhttp3.Call localVarCall = getLookupStatusValidateBeforeCall(accountId, requestId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Lookup Request Status (asynchronously) + * Get an existing Phone Number Lookup Request. + * @param accountId Your Bandwidth Account ID. (required) + * @param requestId The phone number lookup request ID from Bandwidth. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too Many Requests -
500 Internal Server Error -
+ */ + public okhttp3.Call getLookupStatusAsync(String accountId, String requestId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getLookupStatusValidateBeforeCall(accountId, requestId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/RecordingsApi.java b/src/main/java/com/bandwidth/sdk/api/RecordingsApi.java new file mode 100644 index 00000000..5666d38a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/RecordingsApi.java @@ -0,0 +1,1824 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.CallRecordingMetadata; +import java.io.File; +import com.bandwidth.sdk.model.TranscribeRecording; +import com.bandwidth.sdk.model.TranscriptionList; +import com.bandwidth.sdk.model.UpdateCallRecording; +import com.bandwidth.sdk.model.VoiceApiError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class RecordingsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public RecordingsApi() { + this(Configuration.getDefaultApiClient()); + } + + public RecordingsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for deleteCallTranscription + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The transcription was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteCallTranscriptionCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteCallTranscriptionValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteCallTranscription(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling deleteCallTranscription(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling deleteCallTranscription(Async)"); + } + + return deleteCallTranscriptionCall(accountId, callId, recordingId, _callback); + + } + + /** + * Delete Transcription + * Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The transcription was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void deleteCallTranscription(String accountId, String callId, String recordingId) throws ApiException { + deleteCallTranscriptionWithHttpInfo(accountId, callId, recordingId); + } + + /** + * Delete Transcription + * Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The transcription was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse deleteCallTranscriptionWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = deleteCallTranscriptionValidateBeforeCall(accountId, callId, recordingId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Transcription (asynchronously) + * Deletes the specified recording's transcription. Note: After the deletion is requested and a `204` is returned, the transcription will not be accessible anymore. However, it is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The transcription was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteCallTranscriptionAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteCallTranscriptionValidateBeforeCall(accountId, callId, recordingId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Recording was deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteRecordingCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRecordingValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteRecording(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling deleteRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling deleteRecording(Async)"); + } + + return deleteRecordingCall(accountId, callId, recordingId, _callback); + + } + + /** + * Delete Recording + * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Recording was deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void deleteRecording(String accountId, String callId, String recordingId) throws ApiException { + deleteRecordingWithHttpInfo(accountId, callId, recordingId); + } + + /** + * Delete Recording + * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Recording was deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse deleteRecordingWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = deleteRecordingValidateBeforeCall(accountId, callId, recordingId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Recording (asynchronously) + * Delete the recording information, media and transcription. Note: After the deletion is requested and a `204` is returned, neither the recording metadata nor the actual media nor its transcription will be accessible anymore. However, the media of the specified recording is not deleted immediately. This deletion process, while transparent and irreversible, can take an additional 24 to 48 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Recording was deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteRecordingAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRecordingValidateBeforeCall(accountId, callId, recordingId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for deleteRecordingMedia + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The recording media was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteRecordingMediaCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRecordingMediaValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling deleteRecordingMedia(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling deleteRecordingMedia(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling deleteRecordingMedia(Async)"); + } + + return deleteRecordingMediaCall(accountId, callId, recordingId, _callback); + + } + + /** + * Delete Recording Media + * Deletes the specified recording's media. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The recording media was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void deleteRecordingMedia(String accountId, String callId, String recordingId) throws ApiException { + deleteRecordingMediaWithHttpInfo(accountId, callId, recordingId); + } + + /** + * Delete Recording Media + * Deletes the specified recording's media. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The recording media was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse deleteRecordingMediaWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = deleteRecordingMediaValidateBeforeCall(accountId, callId, recordingId, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Delete Recording Media (asynchronously) + * Deletes the specified recording's media. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 The recording media was successfully deleted. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call deleteRecordingMediaAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRecordingMediaValidateBeforeCall(accountId, callId, recordingId, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for downloadCallRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call downloadCallRecordingCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "audio/vnd.wave", + "audio/mpeg", + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call downloadCallRecordingValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling downloadCallRecording(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling downloadCallRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling downloadCallRecording(Async)"); + } + + return downloadCallRecordingCall(accountId, callId, recordingId, _callback); + + } + + /** + * Download Recording + * Downloads the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public File downloadCallRecording(String accountId, String callId, String recordingId) throws ApiException { + ApiResponse localVarResp = downloadCallRecordingWithHttpInfo(accountId, callId, recordingId); + return localVarResp.getData(); + } + + /** + * Download Recording + * Downloads the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse downloadCallRecordingWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = downloadCallRecordingValidateBeforeCall(accountId, callId, recordingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Download Recording (asynchronously) + * Downloads the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Media found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call downloadCallRecordingAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = downloadCallRecordingValidateBeforeCall(accountId, callId, recordingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCallRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallRecordingCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCallRecordingValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getCallRecording(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling getCallRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling getCallRecording(Async)"); + } + + return getCallRecordingCall(accountId, callId, recordingId, _callback); + + } + + /** + * Get Call Recording + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return CallRecordingMetadata + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public CallRecordingMetadata getCallRecording(String accountId, String callId, String recordingId) throws ApiException { + ApiResponse localVarResp = getCallRecordingWithHttpInfo(accountId, callId, recordingId); + return localVarResp.getData(); + } + + /** + * Get Call Recording + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<CallRecordingMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getCallRecordingWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = getCallRecordingValidateBeforeCall(accountId, callId, recordingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Call Recording (asynchronously) + * Returns metadata for the specified recording. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallRecordingAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCallRecordingValidateBeforeCall(accountId, callId, recordingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getCallTranscription + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Transcription found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallTranscriptionCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCallTranscriptionValidateBeforeCall(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getCallTranscription(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling getCallTranscription(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling getCallTranscription(Async)"); + } + + return getCallTranscriptionCall(accountId, callId, recordingId, _callback); + + } + + /** + * Get Transcription + * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return TranscriptionList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Transcription found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public TranscriptionList getCallTranscription(String accountId, String callId, String recordingId) throws ApiException { + ApiResponse localVarResp = getCallTranscriptionWithHttpInfo(accountId, callId, recordingId); + return localVarResp.getData(); + } + + /** + * Get Transcription + * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @return ApiResponse<TranscriptionList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Transcription found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getCallTranscriptionWithHttpInfo(String accountId, String callId, String recordingId) throws ApiException { + okhttp3.Call localVarCall = getCallTranscriptionValidateBeforeCall(accountId, callId, recordingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Transcription (asynchronously) + * Downloads the specified transcription. If the transcribed recording was multi-channel, then there will be 2 transcripts. The caller/called party transcript will be the first item while [`<PlayAudio>`](/docs/voice/bxml/playAudio) and [`<SpeakSentence>`](/docs/voice/bxml/speakSentence) transcript will be the second item. During a [`<Transfer>`](/docs/voice/bxml/transfer) the A-leg transcript will be the first item while the B-leg transcript will be the second item. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Transcription found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getCallTranscriptionAsync(String accountId, String callId, String recordingId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCallTranscriptionValidateBeforeCall(accountId, callId, recordingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listAccountCallRecordings + * @param accountId Your Bandwidth Account ID. (required) + * @param to Filter results by the `to` field. (optional) + * @param from Filter results by the `from` field. (optional) + * @param minStartTime Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param maxStartTime Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listAccountCallRecordingsCall(String accountId, String to, String from, String minStartTime, String maxStartTime, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/recordings" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (to != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("to", to)); + } + + if (from != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("from", from)); + } + + if (minStartTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("minStartTime", minStartTime)); + } + + if (maxStartTime != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("maxStartTime", maxStartTime)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listAccountCallRecordingsValidateBeforeCall(String accountId, String to, String from, String minStartTime, String maxStartTime, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listAccountCallRecordings(Async)"); + } + + return listAccountCallRecordingsCall(accountId, to, from, minStartTime, maxStartTime, _callback); + + } + + /** + * Get Call Recordings + * Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. + * @param accountId Your Bandwidth Account ID. (required) + * @param to Filter results by the `to` field. (optional) + * @param from Filter results by the `from` field. (optional) + * @param minStartTime Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param maxStartTime Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @return List<CallRecordingMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public List listAccountCallRecordings(String accountId, String to, String from, String minStartTime, String maxStartTime) throws ApiException { + ApiResponse> localVarResp = listAccountCallRecordingsWithHttpInfo(accountId, to, from, minStartTime, maxStartTime); + return localVarResp.getData(); + } + + /** + * Get Call Recordings + * Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. + * @param accountId Your Bandwidth Account ID. (required) + * @param to Filter results by the `to` field. (optional) + * @param from Filter results by the `from` field. (optional) + * @param minStartTime Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param maxStartTime Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @return ApiResponse<List<CallRecordingMetadata>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse> listAccountCallRecordingsWithHttpInfo(String accountId, String to, String from, String minStartTime, String maxStartTime) throws ApiException { + okhttp3.Call localVarCall = listAccountCallRecordingsValidateBeforeCall(accountId, to, from, minStartTime, maxStartTime, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Call Recordings (asynchronously) + * Returns a list of metadata for the recordings associated with the specified account. The list can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list is capped at 1000 entries and may be empty if no recordings match the specified criteria. + * @param accountId Your Bandwidth Account ID. (required) + * @param to Filter results by the `to` field. (optional) + * @param from Filter results by the `from` field. (optional) + * @param minStartTime Filter results to recordings which have a `startTime` after or including `minStartTime` (in ISO8601 format). (optional) + * @param maxStartTime Filter results to recordings which have a `startTime` before `maxStartTime` (in ISO8601 format). (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listAccountCallRecordingsAsync(String accountId, String to, String from, String minStartTime, String maxStartTime, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listAccountCallRecordingsValidateBeforeCall(accountId, to, from, minStartTime, maxStartTime, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for listCallRecordings + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listCallRecordingsCall(String accountId, String callId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call listCallRecordingsValidateBeforeCall(String accountId, String callId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling listCallRecordings(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling listCallRecordings(Async)"); + } + + return listCallRecordingsCall(accountId, callId, _callback); + + } + + /** + * List Call Recordings + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @return List<CallRecordingMetadata> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public List listCallRecordings(String accountId, String callId) throws ApiException { + ApiResponse> localVarResp = listCallRecordingsWithHttpInfo(accountId, callId); + return localVarResp.getData(); + } + + /** + * List Call Recordings + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @return ApiResponse<List<CallRecordingMetadata>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse> listCallRecordingsWithHttpInfo(String accountId, String callId) throws ApiException { + okhttp3.Call localVarCall = listCallRecordingsValidateBeforeCall(accountId, callId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * List Call Recordings (asynchronously) + * Returns a (potentially empty) list of metadata for the recordings that took place during the specified call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recordings retrieved successfully -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call listCallRecordingsAsync(String accountId, String callId, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = listCallRecordingsValidateBeforeCall(accountId, callId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for transcribeCallRecording + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param transcribeRecording (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Transcription was successfully requested. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call transcribeCallRecordingCall(String accountId, String callId, String recordingId, TranscribeRecording transcribeRecording, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = transcribeRecording; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())) + .replace("{" + "recordingId" + "}", localVarApiClient.escapeString(recordingId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call transcribeCallRecordingValidateBeforeCall(String accountId, String callId, String recordingId, TranscribeRecording transcribeRecording, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling transcribeCallRecording(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling transcribeCallRecording(Async)"); + } + + // verify the required parameter 'recordingId' is set + if (recordingId == null) { + throw new ApiException("Missing the required parameter 'recordingId' when calling transcribeCallRecording(Async)"); + } + + // verify the required parameter 'transcribeRecording' is set + if (transcribeRecording == null) { + throw new ApiException("Missing the required parameter 'transcribeRecording' when calling transcribeCallRecording(Async)"); + } + + return transcribeCallRecordingCall(accountId, callId, recordingId, transcribeRecording, _callback); + + } + + /** + * Create Transcription Request + * Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param transcribeRecording (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Transcription was successfully requested. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void transcribeCallRecording(String accountId, String callId, String recordingId, TranscribeRecording transcribeRecording) throws ApiException { + transcribeCallRecordingWithHttpInfo(accountId, callId, recordingId, transcribeRecording); + } + + /** + * Create Transcription Request + * Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param transcribeRecording (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Transcription was successfully requested. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse transcribeCallRecordingWithHttpInfo(String accountId, String callId, String recordingId, TranscribeRecording transcribeRecording) throws ApiException { + okhttp3.Call localVarCall = transcribeCallRecordingValidateBeforeCall(accountId, callId, recordingId, transcribeRecording, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Create Transcription Request (asynchronously) + * Generate the transcription for a specific recording. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param recordingId Programmable Voice API Recording ID. (required) + * @param transcribeRecording (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
204 Transcription was successfully requested. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call transcribeCallRecordingAsync(String accountId, String callId, String recordingId, TranscribeRecording transcribeRecording, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = transcribeCallRecordingValidateBeforeCall(accountId, callId, recordingId, transcribeRecording, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + /** + * Build call for updateCallRecordingState + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCallRecording (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording state was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallRecordingStateCall(String accountId, String callId, UpdateCallRecording updateCallRecording, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = updateCallRecording; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/calls/{callId}/recording" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())) + .replace("{" + "callId" + "}", localVarApiClient.escapeString(callId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateCallRecordingStateValidateBeforeCall(String accountId, String callId, UpdateCallRecording updateCallRecording, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling updateCallRecordingState(Async)"); + } + + // verify the required parameter 'callId' is set + if (callId == null) { + throw new ApiException("Missing the required parameter 'callId' when calling updateCallRecordingState(Async)"); + } + + // verify the required parameter 'updateCallRecording' is set + if (updateCallRecording == null) { + throw new ApiException("Missing the required parameter 'updateCallRecording' when calling updateCallRecordingState(Async)"); + } + + return updateCallRecordingStateCall(accountId, callId, updateCallRecording, _callback); + + } + + /** + * Update Recording + * Pause or resume a recording on an active phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCallRecording (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording state was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public void updateCallRecordingState(String accountId, String callId, UpdateCallRecording updateCallRecording) throws ApiException { + updateCallRecordingStateWithHttpInfo(accountId, callId, updateCallRecording); + } + + /** + * Update Recording + * Pause or resume a recording on an active phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCallRecording (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording state was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse updateCallRecordingStateWithHttpInfo(String accountId, String callId, UpdateCallRecording updateCallRecording) throws ApiException { + okhttp3.Call localVarCall = updateCallRecordingStateValidateBeforeCall(accountId, callId, updateCallRecording, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Update Recording (asynchronously) + * Pause or resume a recording on an active phone call. + * @param accountId Your Bandwidth Account ID. (required) + * @param callId Programmable Voice API Call ID. (required) + * @param updateCallRecording (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Recording state was successfully modified. -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call updateCallRecordingStateAsync(String accountId, String callId, UpdateCallRecording updateCallRecording, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateCallRecordingStateValidateBeforeCall(accountId, callId, updateCallRecording, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/api/StatisticsApi.java b/src/main/java/com/bandwidth/sdk/api/StatisticsApi.java new file mode 100644 index 00000000..0be3310e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/api/StatisticsApi.java @@ -0,0 +1,231 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiCallback; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ProgressRequestBody; +import com.bandwidth.sdk.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.bandwidth.sdk.model.AccountStatistics; +import com.bandwidth.sdk.model.VoiceApiError; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class StatisticsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StatisticsApi() { + this(Configuration.getDefaultApiClient()); + } + + public StatisticsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for getStatistics + * @param accountId Your Bandwidth Account ID. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Statistics Found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getStatisticsCall(String accountId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { "https://voice.bandwidth.com/api/v2" }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/accounts/{accountId}/statistics" + .replace("{" + "accountId" + "}", localVarApiClient.escapeString(accountId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getStatisticsValidateBeforeCall(String accountId, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'accountId' is set + if (accountId == null) { + throw new ApiException("Missing the required parameter 'accountId' when calling getStatistics(Async)"); + } + + return getStatisticsCall(accountId, _callback); + + } + + /** + * Get Account Statistics + * Returns details about the current state of the account. + * @param accountId Your Bandwidth Account ID. (required) + * @return AccountStatistics + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Statistics Found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public AccountStatistics getStatistics(String accountId) throws ApiException { + ApiResponse localVarResp = getStatisticsWithHttpInfo(accountId); + return localVarResp.getData(); + } + + /** + * Get Account Statistics + * Returns details about the current state of the account. + * @param accountId Your Bandwidth Account ID. (required) + * @return ApiResponse<AccountStatistics> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Statistics Found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public ApiResponse getStatisticsWithHttpInfo(String accountId) throws ApiException { + okhttp3.Call localVarCall = getStatisticsValidateBeforeCall(accountId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get Account Statistics (asynchronously) + * Returns details about the current state of the account. + * @param accountId Your Bandwidth Account ID. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + + + +
Status Code Description Response Headers
200 Statistics Found -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
405 Method Not Allowed -
415 Unsupported Media Type -
429 Too Many Requests * Retry-After - When you should try your request again.
500 Internal Server Error -
+ */ + public okhttp3.Call getStatisticsAsync(String accountId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getStatisticsValidateBeforeCall(accountId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java b/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java new file mode 100644 index 00000000..afb43664 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.auth; + +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/src/main/java/com/bandwidth/sdk/auth/Authentication.java b/src/main/java/com/bandwidth/sdk/auth/Authentication.java new file mode 100644 index 00000000..243865e9 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/auth/Authentication.java @@ -0,0 +1,36 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.auth; + +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java new file mode 100644 index 00000000..d313b5b0 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/auth/HttpBasicAuth.java @@ -0,0 +1,57 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.auth; + +import com.bandwidth.sdk.Pair; +import com.bandwidth.sdk.ApiException; + +import okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +import java.io.UnsupportedEncodingException; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java new file mode 100644 index 00000000..ab606dc1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/auth/HttpBearerAuth.java @@ -0,0 +1,63 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.auth; + +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private String bearerToken; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return bearerToken; + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.bearerToken = bearerToken; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (bearerToken == null) { + return; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java new file mode 100644 index 00000000..e46f5463 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/AbstractOpenApiSchema.java @@ -0,0 +1,148 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.bandwidth.sdk.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +//import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java new file mode 100644 index 00000000..a2a910fa --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/AccountStatistics.java @@ -0,0 +1,310 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * AccountStatistics + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class AccountStatistics { + public static final String SERIALIZED_NAME_CURRENT_CALL_QUEUE_SIZE = "currentCallQueueSize"; + @SerializedName(SERIALIZED_NAME_CURRENT_CALL_QUEUE_SIZE) + private Integer currentCallQueueSize; + + public static final String SERIALIZED_NAME_MAX_CALL_QUEUE_SIZE = "maxCallQueueSize"; + @SerializedName(SERIALIZED_NAME_MAX_CALL_QUEUE_SIZE) + private Integer maxCallQueueSize; + + public AccountStatistics() { + } + + public AccountStatistics currentCallQueueSize(Integer currentCallQueueSize) { + + this.currentCallQueueSize = currentCallQueueSize; + return this; + } + + /** + * The number of calls currently enqueued. + * @return currentCallQueueSize + **/ + @javax.annotation.Nullable + public Integer getCurrentCallQueueSize() { + return currentCallQueueSize; + } + + + public void setCurrentCallQueueSize(Integer currentCallQueueSize) { + this.currentCallQueueSize = currentCallQueueSize; + } + + + public AccountStatistics maxCallQueueSize(Integer maxCallQueueSize) { + + this.maxCallQueueSize = maxCallQueueSize; + return this; + } + + /** + * The maximum size of the queue before outgoing calls start being rejected. + * @return maxCallQueueSize + **/ + @javax.annotation.Nullable + public Integer getMaxCallQueueSize() { + return maxCallQueueSize; + } + + + public void setMaxCallQueueSize(Integer maxCallQueueSize) { + this.maxCallQueueSize = maxCallQueueSize; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AccountStatistics instance itself + */ + public AccountStatistics putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountStatistics accountStatistics = (AccountStatistics) o; + return Objects.equals(this.currentCallQueueSize, accountStatistics.currentCallQueueSize) && + Objects.equals(this.maxCallQueueSize, accountStatistics.maxCallQueueSize)&& + Objects.equals(this.additionalProperties, accountStatistics.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(currentCallQueueSize, maxCallQueueSize, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountStatistics {\n"); + sb.append(" currentCallQueueSize: ").append(toIndentedString(currentCallQueueSize)).append("\n"); + sb.append(" maxCallQueueSize: ").append(toIndentedString(maxCallQueueSize)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("currentCallQueueSize"); + openapiFields.add("maxCallQueueSize"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AccountStatistics + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AccountStatistics.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AccountStatistics is not found in the empty JSON string", AccountStatistics.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AccountStatistics.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AccountStatistics' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AccountStatistics.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AccountStatistics value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AccountStatistics read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AccountStatistics instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AccountStatistics given an JSON string + * + * @param jsonString JSON string + * @return An instance of AccountStatistics + * @throws IOException if the JSON string is invalid with respect to AccountStatistics + */ + public static AccountStatistics fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AccountStatistics.class); + } + + /** + * Convert an instance of AccountStatistics to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java new file mode 100644 index 00000000..b5b716a0 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/AnswerCallback.java @@ -0,0 +1,689 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.MachineDetectionResult; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Answer event is sent to the answerUrl specified in the createCall request when an outbound call is answered. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class AnswerCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MACHINE_DETECTION_RESULT = "machineDetectionResult"; + @SerializedName(SERIALIZED_NAME_MACHINE_DETECTION_RESULT) + private MachineDetectionResult machineDetectionResult; + + public AnswerCallback() { + } + + public AnswerCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public AnswerCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public AnswerCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public AnswerCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public AnswerCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public AnswerCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public AnswerCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public AnswerCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public AnswerCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public AnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public AnswerCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public AnswerCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public AnswerCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public AnswerCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { + + this.machineDetectionResult = machineDetectionResult; + return this; + } + + /** + * Get machineDetectionResult + * @return machineDetectionResult + **/ + @javax.annotation.Nullable + public MachineDetectionResult getMachineDetectionResult() { + return machineDetectionResult; + } + + + public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { + this.machineDetectionResult = machineDetectionResult; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AnswerCallback instance itself + */ + public AnswerCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnswerCallback answerCallback = (AnswerCallback) o; + return Objects.equals(this.eventType, answerCallback.eventType) && + Objects.equals(this.eventTime, answerCallback.eventTime) && + Objects.equals(this.accountId, answerCallback.accountId) && + Objects.equals(this.applicationId, answerCallback.applicationId) && + Objects.equals(this.from, answerCallback.from) && + Objects.equals(this.to, answerCallback.to) && + Objects.equals(this.direction, answerCallback.direction) && + Objects.equals(this.callId, answerCallback.callId) && + Objects.equals(this.callUrl, answerCallback.callUrl) && + Objects.equals(this.enqueuedTime, answerCallback.enqueuedTime) && + Objects.equals(this.startTime, answerCallback.startTime) && + Objects.equals(this.answerTime, answerCallback.answerTime) && + Objects.equals(this.tag, answerCallback.tag) && + Objects.equals(this.machineDetectionResult, answerCallback.machineDetectionResult)&& + Objects.equals(this.additionalProperties, answerCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, machineDetectionResult, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnswerCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" machineDetectionResult: ").append(toIndentedString(machineDetectionResult)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("machineDetectionResult"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AnswerCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnswerCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AnswerCallback is not found in the empty JSON string", AnswerCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // validate the optional field `machineDetectionResult` + if (jsonObj.get("machineDetectionResult") != null && !jsonObj.get("machineDetectionResult").isJsonNull()) { + MachineDetectionResult.validateJsonElement(jsonObj.get("machineDetectionResult")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnswerCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnswerCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnswerCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnswerCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AnswerCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AnswerCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnswerCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnswerCallback + * @throws IOException if the JSON string is invalid with respect to AnswerCallback + */ + public static AnswerCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnswerCallback.class); + } + + /** + * Convert an instance of AnswerCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java new file mode 100644 index 00000000..cf07b02d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/BridgeCompleteCallback.java @@ -0,0 +1,749 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * If the target call leaves the <Bridge>, then this callback is sent to the bridgeCompleteUrl, and the BXML returned in it is executed on the call. If this webhook is sent, the Bridge Target Complete webhook is NOT sent. This callback is also sent if any problem occurs that prevents the calls to be bridged. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class BridgeCompleteCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_CAUSE = "cause"; + @SerializedName(SERIALIZED_NAME_CAUSE) + private String cause; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_ERROR_ID = "errorId"; + @SerializedName(SERIALIZED_NAME_ERROR_ID) + private String errorId; + + public BridgeCompleteCallback() { + } + + public BridgeCompleteCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public BridgeCompleteCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public BridgeCompleteCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public BridgeCompleteCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public BridgeCompleteCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public BridgeCompleteCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public BridgeCompleteCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public BridgeCompleteCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public BridgeCompleteCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public BridgeCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public BridgeCompleteCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public BridgeCompleteCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public BridgeCompleteCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public BridgeCompleteCallback cause(String cause) { + + this.cause = cause; + return this; + } + + /** + * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * @return cause + **/ + @javax.annotation.Nullable + public String getCause() { + return cause; + } + + + public void setCause(String cause) { + this.cause = cause; + } + + + public BridgeCompleteCallback errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * Text explaining the reason that caused the call to fail in case of errors. + * @return errorMessage + **/ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + public BridgeCompleteCallback errorId(String errorId) { + + this.errorId = errorId; + return this; + } + + /** + * Bandwidth's internal id that references the error event. + * @return errorId + **/ + @javax.annotation.Nullable + public String getErrorId() { + return errorId; + } + + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BridgeCompleteCallback instance itself + */ + public BridgeCompleteCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BridgeCompleteCallback bridgeCompleteCallback = (BridgeCompleteCallback) o; + return Objects.equals(this.eventType, bridgeCompleteCallback.eventType) && + Objects.equals(this.eventTime, bridgeCompleteCallback.eventTime) && + Objects.equals(this.accountId, bridgeCompleteCallback.accountId) && + Objects.equals(this.applicationId, bridgeCompleteCallback.applicationId) && + Objects.equals(this.from, bridgeCompleteCallback.from) && + Objects.equals(this.to, bridgeCompleteCallback.to) && + Objects.equals(this.direction, bridgeCompleteCallback.direction) && + Objects.equals(this.callId, bridgeCompleteCallback.callId) && + Objects.equals(this.callUrl, bridgeCompleteCallback.callUrl) && + Objects.equals(this.enqueuedTime, bridgeCompleteCallback.enqueuedTime) && + Objects.equals(this.startTime, bridgeCompleteCallback.startTime) && + Objects.equals(this.answerTime, bridgeCompleteCallback.answerTime) && + Objects.equals(this.tag, bridgeCompleteCallback.tag) && + Objects.equals(this.cause, bridgeCompleteCallback.cause) && + Objects.equals(this.errorMessage, bridgeCompleteCallback.errorMessage) && + Objects.equals(this.errorId, bridgeCompleteCallback.errorId)&& + Objects.equals(this.additionalProperties, bridgeCompleteCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, cause, errorMessage, errorId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BridgeCompleteCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" cause: ").append(toIndentedString(cause)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorId: ").append(toIndentedString(errorId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("cause"); + openapiFields.add("errorMessage"); + openapiFields.add("errorId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BridgeCompleteCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BridgeCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BridgeCompleteCallback is not found in the empty JSON string", BridgeCompleteCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("cause") != null && !jsonObj.get("cause").isJsonNull()) && !jsonObj.get("cause").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cause` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cause").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("errorId") != null && !jsonObj.get("errorId").isJsonNull()) && !jsonObj.get("errorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BridgeCompleteCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BridgeCompleteCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BridgeCompleteCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BridgeCompleteCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BridgeCompleteCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BridgeCompleteCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BridgeCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of BridgeCompleteCallback + * @throws IOException if the JSON string is invalid with respect to BridgeCompleteCallback + */ + public static BridgeCompleteCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BridgeCompleteCallback.class); + } + + /** + * Convert an instance of BridgeCompleteCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java new file mode 100644 index 00000000..69d771e7 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallback.java @@ -0,0 +1,656 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * If the originating call leaves the <Bridge>, then this callback is sent to the bridgeTargetCompleteUrl, and the BXML returned in it is executed on the target call. If this webhook is sent, the Bridge Complete webhook is NOT sent. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class BridgeTargetCompleteCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public BridgeTargetCompleteCallback() { + } + + public BridgeTargetCompleteCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public BridgeTargetCompleteCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public BridgeTargetCompleteCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public BridgeTargetCompleteCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public BridgeTargetCompleteCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public BridgeTargetCompleteCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public BridgeTargetCompleteCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public BridgeTargetCompleteCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public BridgeTargetCompleteCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public BridgeTargetCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public BridgeTargetCompleteCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public BridgeTargetCompleteCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public BridgeTargetCompleteCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the BridgeTargetCompleteCallback instance itself + */ + public BridgeTargetCompleteCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BridgeTargetCompleteCallback bridgeTargetCompleteCallback = (BridgeTargetCompleteCallback) o; + return Objects.equals(this.eventType, bridgeTargetCompleteCallback.eventType) && + Objects.equals(this.eventTime, bridgeTargetCompleteCallback.eventTime) && + Objects.equals(this.accountId, bridgeTargetCompleteCallback.accountId) && + Objects.equals(this.applicationId, bridgeTargetCompleteCallback.applicationId) && + Objects.equals(this.from, bridgeTargetCompleteCallback.from) && + Objects.equals(this.to, bridgeTargetCompleteCallback.to) && + Objects.equals(this.direction, bridgeTargetCompleteCallback.direction) && + Objects.equals(this.callId, bridgeTargetCompleteCallback.callId) && + Objects.equals(this.callUrl, bridgeTargetCompleteCallback.callUrl) && + Objects.equals(this.enqueuedTime, bridgeTargetCompleteCallback.enqueuedTime) && + Objects.equals(this.startTime, bridgeTargetCompleteCallback.startTime) && + Objects.equals(this.answerTime, bridgeTargetCompleteCallback.answerTime) && + Objects.equals(this.tag, bridgeTargetCompleteCallback.tag)&& + Objects.equals(this.additionalProperties, bridgeTargetCompleteCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BridgeTargetCompleteCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BridgeTargetCompleteCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BridgeTargetCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BridgeTargetCompleteCallback is not found in the empty JSON string", BridgeTargetCompleteCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BridgeTargetCompleteCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BridgeTargetCompleteCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BridgeTargetCompleteCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BridgeTargetCompleteCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public BridgeTargetCompleteCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + BridgeTargetCompleteCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BridgeTargetCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of BridgeTargetCompleteCallback + * @throws IOException if the JSON string is invalid with respect to BridgeTargetCompleteCallback + */ + public static BridgeTargetCompleteCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BridgeTargetCompleteCallback.class); + } + + /** + * Convert an instance of BridgeTargetCompleteCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java new file mode 100644 index 00000000..c6e3ed0e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallDirectionEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The direction of the call. + */ +@JsonAdapter(CallDirectionEnum.Adapter.class) +public enum CallDirectionEnum { + + INBOUND("inbound"), + + OUTBOUND("outbound"); + + private String value; + + CallDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallDirectionEnum fromValue(String value) { + for (CallDirectionEnum b : CallDirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallDirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallDirectionEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java new file mode 100644 index 00000000..a511ce7e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallRecordingMetadata.java @@ -0,0 +1,815 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.bandwidth.sdk.model.TranscriptionMetadata; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CallRecordingMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CallRecordingMetadata { + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CHANNELS = "channels"; + @SerializedName(SERIALIZED_NAME_CHANNELS) + private Integer channels; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public static final String SERIALIZED_NAME_TRANSCRIPTION = "transcription"; + @SerializedName(SERIALIZED_NAME_TRANSCRIPTION) + private TranscriptionMetadata transcription; + + public CallRecordingMetadata() { + } + + public CallRecordingMetadata applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public CallRecordingMetadata accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public CallRecordingMetadata callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public CallRecordingMetadata parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public CallRecordingMetadata recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public CallRecordingMetadata to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public CallRecordingMetadata from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public CallRecordingMetadata transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public CallRecordingMetadata transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + + public CallRecordingMetadata duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public CallRecordingMetadata direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public CallRecordingMetadata channels(Integer channels) { + + this.channels = channels; + return this; + } + + /** + * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * @return channels + **/ + @javax.annotation.Nullable + public Integer getChannels() { + return channels; + } + + + public void setChannels(Integer channels) { + this.channels = channels; + } + + + public CallRecordingMetadata startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public CallRecordingMetadata endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public CallRecordingMetadata fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public CallRecordingMetadata status(String status) { + + this.status = status; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public CallRecordingMetadata mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public CallRecordingMetadata transcription(TranscriptionMetadata transcription) { + + this.transcription = transcription; + return this; + } + + /** + * Get transcription + * @return transcription + **/ + @javax.annotation.Nullable + public TranscriptionMetadata getTranscription() { + return transcription; + } + + + public void setTranscription(TranscriptionMetadata transcription) { + this.transcription = transcription; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CallRecordingMetadata instance itself + */ + public CallRecordingMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CallRecordingMetadata callRecordingMetadata = (CallRecordingMetadata) o; + return Objects.equals(this.applicationId, callRecordingMetadata.applicationId) && + Objects.equals(this.accountId, callRecordingMetadata.accountId) && + Objects.equals(this.callId, callRecordingMetadata.callId) && + Objects.equals(this.parentCallId, callRecordingMetadata.parentCallId) && + Objects.equals(this.recordingId, callRecordingMetadata.recordingId) && + Objects.equals(this.to, callRecordingMetadata.to) && + Objects.equals(this.from, callRecordingMetadata.from) && + Objects.equals(this.transferCallerId, callRecordingMetadata.transferCallerId) && + Objects.equals(this.transferTo, callRecordingMetadata.transferTo) && + Objects.equals(this.duration, callRecordingMetadata.duration) && + Objects.equals(this.direction, callRecordingMetadata.direction) && + Objects.equals(this.channels, callRecordingMetadata.channels) && + Objects.equals(this.startTime, callRecordingMetadata.startTime) && + Objects.equals(this.endTime, callRecordingMetadata.endTime) && + Objects.equals(this.fileFormat, callRecordingMetadata.fileFormat) && + Objects.equals(this.status, callRecordingMetadata.status) && + Objects.equals(this.mediaUrl, callRecordingMetadata.mediaUrl) && + Objects.equals(this.transcription, callRecordingMetadata.transcription)&& + Objects.equals(this.additionalProperties, callRecordingMetadata.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, accountId, callId, parentCallId, recordingId, to, from, transferCallerId, transferTo, duration, direction, channels, startTime, endTime, fileFormat, status, mediaUrl, transcription, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallRecordingMetadata {\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" transcription: ").append(toIndentedString(transcription)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicationId"); + openapiFields.add("accountId"); + openapiFields.add("callId"); + openapiFields.add("parentCallId"); + openapiFields.add("recordingId"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + openapiFields.add("duration"); + openapiFields.add("direction"); + openapiFields.add("channels"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("fileFormat"); + openapiFields.add("status"); + openapiFields.add("mediaUrl"); + openapiFields.add("transcription"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallRecordingMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CallRecordingMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CallRecordingMetadata is not found in the empty JSON string", CallRecordingMetadata.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + // validate the optional field `transcription` + if (jsonObj.get("transcription") != null && !jsonObj.get("transcription").isJsonNull()) { + TranscriptionMetadata.validateJsonElement(jsonObj.get("transcription")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CallRecordingMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallRecordingMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CallRecordingMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CallRecordingMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CallRecordingMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CallRecordingMetadata instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CallRecordingMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallRecordingMetadata + * @throws IOException if the JSON string is invalid with respect to CallRecordingMetadata + */ + public static CallRecordingMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CallRecordingMetadata.class); + } + + /** + * Convert an instance of CallRecordingMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CallState.java b/src/main/java/com/bandwidth/sdk/model/CallState.java new file mode 100644 index 00000000..b5959bf4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallState.java @@ -0,0 +1,815 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CallState + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CallState { + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private String state; + + public static final String SERIALIZED_NAME_STIR_SHAKEN = "stirShaken"; + @SerializedName(SERIALIZED_NAME_STIR_SHAKEN) + private Map stirShaken; + + public static final String SERIALIZED_NAME_IDENTITY = "identity"; + @SerializedName(SERIALIZED_NAME_IDENTITY) + private String identity; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_DISCONNECT_CAUSE = "disconnectCause"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_CAUSE) + private String disconnectCause; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_ERROR_ID = "errorId"; + @SerializedName(SERIALIZED_NAME_ERROR_ID) + private String errorId; + + public static final String SERIALIZED_NAME_LAST_UPDATE = "lastUpdate"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATE) + private OffsetDateTime lastUpdate; + + public CallState() { + } + + public CallState applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The application id associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public CallState accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The account id associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public CallState callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The programmable voice API call ID. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public CallState parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * The A-leg call id, set only if this call is the B-leg of a [`<Transfer>`](/docs/voice/bxml/transfer). + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public CallState to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555), or if the call was to a SIP URI, the SIP URI. + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public CallState from(String from) { + + this.from = from; + return this; + } + + /** + * The phone number that made the call, in E.164 format (e.g. +15555555555). + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public CallState direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public CallState state(String state) { + + this.state = state; + return this; + } + + /** + * The current state of the call. Current possible values are `queued`, `initiated`, `answered` and `disconnected`. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return state + **/ + @javax.annotation.Nullable + public String getState() { + return state; + } + + + public void setState(String state) { + this.state = state; + } + + + public CallState stirShaken(Map stirShaken) { + + this.stirShaken = stirShaken; + return this; + } + + public CallState putStirShakenItem(String key, String stirShakenItem) { + if (this.stirShaken == null) { + this.stirShaken = new HashMap<>(); + } + this.stirShaken.put(key, stirShakenItem); + return this; + } + + /** + * For inbound calls, the Bandwidth STIR/SHAKEN implementation will verify the information provided in the inbound invite request `Identity` header. The verification status is stored in the call state `stirShaken` property as follows. | Property | Description | |:------------------|:------------| | verstat | (optional) The verification status indicating whether the verification was successful or not. Possible values are `TN-Verification-Passed` or `TN-Verification-Failed`. | | attestationIndicator | (optional) The attestation level verified by Bandwidth. Possible values are `A` (full), `B` (partial) or `C` (gateway). | | originatingId | (optional) A unique origination identifier. | Note that these are common properties but that the `stirShaken` object is free form and can contain other key-value pairs. More information: [Understanding STIR/SHAKEN](https://www.bandwidth.com/regulations/stir-shaken). + * @return stirShaken + **/ + @javax.annotation.Nullable + public Map getStirShaken() { + return stirShaken; + } + + + public void setStirShaken(Map stirShaken) { + this.stirShaken = stirShaken; + } + + + public CallState identity(String identity) { + + this.identity = identity; + return this; + } + + /** + * The value of the `Identity` header from the inbound invite request. Only present for inbound calls and if the account is configured to forward this header. + * @return identity + **/ + @javax.annotation.Nullable + public String getIdentity() { + return identity; + } + + + public void setIdentity(String identity) { + this.identity = identity; + } + + + public CallState enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * The time this call was placed in queue. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public CallState startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * The time the call was initiated, in ISO 8601 format. `null` if the call is still in your queue. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public CallState answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Populated once the call has been answered, with the time in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public CallState endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * Populated once the call has ended, with the time in ISO 8601 format. + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public CallState disconnectCause(String disconnectCause) { + + this.disconnectCause = disconnectCause; + return this; + } + + /** + * | Cause | Description | |:------|:------------| | `hangup`| One party hung up the call, a [`<Hangup>`](../../bxml/verbs/hangup.md) verb was executed, or there was no more BXML to execute; it indicates that the call ended normally. | | `busy` | Callee was busy. | | `timeout` | Call wasn't answered before the `callTimeout` was reached. | | `cancel` | Call was cancelled by its originator while it was ringing. | | `rejected` | Call was rejected by the callee. | | `callback-error` | BXML callback couldn't be delivered to your callback server. | | `invalid-bxml` | Invalid BXML was returned in response to a callback. | | `application-error` | An unsupported action was tried on the call, e.g. trying to play a .ogg audio. | | `account-limit` | Account rate limits were reached. | | `node-capacity-exceeded` | System maximum capacity was reached. | | `error` | Some error not described in any of the other causes happened on the call. | | `unknown` | Unknown error happened on the call. | Note: This list is not exhaustive and other values can appear in the future. + * @return disconnectCause + **/ + @javax.annotation.Nullable + public String getDisconnectCause() { + return disconnectCause; + } + + + public void setDisconnectCause(String disconnectCause) { + this.disconnectCause = disconnectCause; + } + + + public CallState errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * Populated only if the call ended with an error, with text explaining the reason. + * @return errorMessage + **/ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + public CallState errorId(String errorId) { + + this.errorId = errorId; + return this; + } + + /** + * Populated only if the call ended with an error, with a Bandwidth internal id that references the error event. + * @return errorId + **/ + @javax.annotation.Nullable + public String getErrorId() { + return errorId; + } + + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + + public CallState lastUpdate(OffsetDateTime lastUpdate) { + + this.lastUpdate = lastUpdate; + return this; + } + + /** + * The last time the call had a state update, in ISO 8601 format. + * @return lastUpdate + **/ + @javax.annotation.Nullable + public OffsetDateTime getLastUpdate() { + return lastUpdate; + } + + + public void setLastUpdate(OffsetDateTime lastUpdate) { + this.lastUpdate = lastUpdate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CallState instance itself + */ + public CallState putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CallState callState = (CallState) o; + return Objects.equals(this.applicationId, callState.applicationId) && + Objects.equals(this.accountId, callState.accountId) && + Objects.equals(this.callId, callState.callId) && + Objects.equals(this.parentCallId, callState.parentCallId) && + Objects.equals(this.to, callState.to) && + Objects.equals(this.from, callState.from) && + Objects.equals(this.direction, callState.direction) && + Objects.equals(this.state, callState.state) && + Objects.equals(this.stirShaken, callState.stirShaken) && + Objects.equals(this.identity, callState.identity) && + Objects.equals(this.enqueuedTime, callState.enqueuedTime) && + Objects.equals(this.startTime, callState.startTime) && + Objects.equals(this.answerTime, callState.answerTime) && + Objects.equals(this.endTime, callState.endTime) && + Objects.equals(this.disconnectCause, callState.disconnectCause) && + Objects.equals(this.errorMessage, callState.errorMessage) && + Objects.equals(this.errorId, callState.errorId) && + Objects.equals(this.lastUpdate, callState.lastUpdate)&& + Objects.equals(this.additionalProperties, callState.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, accountId, callId, parentCallId, to, from, direction, state, stirShaken, identity, enqueuedTime, startTime, answerTime, endTime, disconnectCause, errorMessage, errorId, lastUpdate, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallState {\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" stirShaken: ").append(toIndentedString(stirShaken)).append("\n"); + sb.append(" identity: ").append(toIndentedString(identity)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" disconnectCause: ").append(toIndentedString(disconnectCause)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorId: ").append(toIndentedString(errorId)).append("\n"); + sb.append(" lastUpdate: ").append(toIndentedString(lastUpdate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicationId"); + openapiFields.add("accountId"); + openapiFields.add("callId"); + openapiFields.add("parentCallId"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("direction"); + openapiFields.add("state"); + openapiFields.add("stirShaken"); + openapiFields.add("identity"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("endTime"); + openapiFields.add("disconnectCause"); + openapiFields.add("errorMessage"); + openapiFields.add("errorId"); + openapiFields.add("lastUpdate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallState + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CallState.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CallState is not found in the empty JSON string", CallState.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("state") != null && !jsonObj.get("state").isJsonNull()) && !jsonObj.get("state").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `state` to be a primitive type in the JSON string but got `%s`", jsonObj.get("state").toString())); + } + if ((jsonObj.get("identity") != null && !jsonObj.get("identity").isJsonNull()) && !jsonObj.get("identity").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `identity` to be a primitive type in the JSON string but got `%s`", jsonObj.get("identity").toString())); + } + if ((jsonObj.get("disconnectCause") != null && !jsonObj.get("disconnectCause").isJsonNull()) && !jsonObj.get("disconnectCause").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `disconnectCause` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disconnectCause").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("errorId") != null && !jsonObj.get("errorId").isJsonNull()) && !jsonObj.get("errorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CallState.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallState' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CallState.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CallState value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CallState read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CallState instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CallState given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallState + * @throws IOException if the JSON string is invalid with respect to CallState + */ + public static CallState fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CallState.class); + } + + /** + * Convert an instance of CallState to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java new file mode 100644 index 00000000..ce57cbb3 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallStateEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The call state. Possible values:<br>`active` to redirect the call (default)<br>`completed` to hang up the call if it is answered, cancel it if it is an unanswered outbound call, or reject it if it an unanswered inbound call + */ +@JsonAdapter(CallStateEnum.Adapter.class) +public enum CallStateEnum { + + ACTIVE("active"), + + COMPLETED("completed"); + + private String value; + + CallStateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallStateEnum fromValue(String value) { + for (CallStateEnum b : CallStateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallStateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallStateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallStateEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java new file mode 100644 index 00000000..f571f1a4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CallbackMethodEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The HTTP method to use to deliver the callback. GET or POST. Default value is POST. + */ +@JsonAdapter(CallbackMethodEnum.Adapter.class) +public enum CallbackMethodEnum { + + GET("GET"), + + POST("POST"); + + private String value; + + CallbackMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CallbackMethodEnum fromValue(String value) { + for (CallbackMethodEnum b : CallbackMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CallbackMethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CallbackMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CallbackMethodEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CodeRequest.java b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java new file mode 100644 index 00000000..48c97b90 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CodeRequest.java @@ -0,0 +1,451 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CodeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CodeRequest { + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) + private String scope; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_DIGITS = "digits"; + @SerializedName(SERIALIZED_NAME_DIGITS) + private Integer digits; + + public CodeRequest() { + } + + public CodeRequest to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number to send the mfa code to. + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public CodeRequest from(String from) { + + this.from = from; + return this; + } + + /** + * The application phone number, the sender of the mfa code. + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public CodeRequest applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The application unique ID, obtained from Bandwidth. + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public CodeRequest scope(String scope) { + + this.scope = scope; + return this; + } + + /** + * An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". + * @return scope + **/ + @javax.annotation.Nullable + public String getScope() { + return scope; + } + + + public void setScope(String scope) { + this.scope = scope; + } + + + public CodeRequest message(String message) { + + this.message = message; + return this; + } + + /** + * The message format of the mfa code. There are three values that the system will replace \"{CODE}\", \"{NAME}\", \"{SCOPE}\". The \"{SCOPE}\" and \"{NAME} value template are optional, while \"{CODE}\" must be supplied. As the name would suggest, code will be replace with the actual mfa code. Name is replaced with the application name, configured during provisioning of mfa. The scope value is the same value sent during the call and partitioned by the server. + * @return message + **/ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public CodeRequest digits(Integer digits) { + + this.digits = digits; + return this; + } + + /** + * The number of digits for your mfa code. The valid number ranges from 2 to 8, inclusively. + * minimum: 4 + * maximum: 8 + * @return digits + **/ + @javax.annotation.Nonnull + public Integer getDigits() { + return digits; + } + + + public void setDigits(Integer digits) { + this.digits = digits; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CodeRequest instance itself + */ + public CodeRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CodeRequest codeRequest = (CodeRequest) o; + return Objects.equals(this.to, codeRequest.to) && + Objects.equals(this.from, codeRequest.from) && + Objects.equals(this.applicationId, codeRequest.applicationId) && + Objects.equals(this.scope, codeRequest.scope) && + Objects.equals(this.message, codeRequest.message) && + Objects.equals(this.digits, codeRequest.digits)&& + Objects.equals(this.additionalProperties, codeRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(to, from, applicationId, scope, message, digits, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CodeRequest {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" digits: ").append(toIndentedString(digits)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("applicationId"); + openapiFields.add("scope"); + openapiFields.add("message"); + openapiFields.add("digits"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("digits"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CodeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CodeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CodeRequest is not found in the empty JSON string", CodeRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CodeRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); + } + if (!jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CodeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CodeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CodeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CodeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CodeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CodeRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CodeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CodeRequest + * @throws IOException if the JSON string is invalid with respect to CodeRequest + */ + public static CodeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CodeRequest.class); + } + + /** + * Convert an instance of CodeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Conference.java b/src/main/java/com/bandwidth/sdk/model/Conference.java new file mode 100644 index 00000000..6a84175f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Conference.java @@ -0,0 +1,530 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.ConferenceMember; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Conference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Conference { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_CREATED_TIME = "createdTime"; + @SerializedName(SERIALIZED_NAME_CREATED_TIME) + private OffsetDateTime createdTime; + + public static final String SERIALIZED_NAME_COMPLETED_TIME = "completedTime"; + @SerializedName(SERIALIZED_NAME_COMPLETED_TIME) + private OffsetDateTime completedTime; + + public static final String SERIALIZED_NAME_CONFERENCE_EVENT_URL = "conferenceEventUrl"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_EVENT_URL) + private URI conferenceEventUrl; + + public static final String SERIALIZED_NAME_CONFERENCE_EVENT_METHOD = "conferenceEventMethod"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_EVENT_METHOD) + private CallbackMethodEnum conferenceEventMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_ACTIVE_MEMBERS = "activeMembers"; + @SerializedName(SERIALIZED_NAME_ACTIVE_MEMBERS) + private List activeMembers; + + public Conference() { + } + + public Conference id(String id) { + + this.id = id; + return this; + } + + /** + * The Bandwidth-generated conference ID. + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Conference name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the conference, as specified by your application. + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public Conference createdTime(OffsetDateTime createdTime) { + + this.createdTime = createdTime; + return this; + } + + /** + * The time the conference was initiated, in ISO 8601 format. + * @return createdTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getCreatedTime() { + return createdTime; + } + + + public void setCreatedTime(OffsetDateTime createdTime) { + this.createdTime = createdTime; + } + + + public Conference completedTime(OffsetDateTime completedTime) { + + this.completedTime = completedTime; + return this; + } + + /** + * The time the conference was terminated, in ISO 8601 format. + * @return completedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getCompletedTime() { + return completedTime; + } + + + public void setCompletedTime(OffsetDateTime completedTime) { + this.completedTime = completedTime; + } + + + public Conference conferenceEventUrl(URI conferenceEventUrl) { + + this.conferenceEventUrl = conferenceEventUrl; + return this; + } + + /** + * The URL to send the conference-related events. + * @return conferenceEventUrl + **/ + @javax.annotation.Nullable + public URI getConferenceEventUrl() { + return conferenceEventUrl; + } + + + public void setConferenceEventUrl(URI conferenceEventUrl) { + this.conferenceEventUrl = conferenceEventUrl; + } + + + public Conference conferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { + + this.conferenceEventMethod = conferenceEventMethod; + return this; + } + + /** + * Get conferenceEventMethod + * @return conferenceEventMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getConferenceEventMethod() { + return conferenceEventMethod; + } + + + public void setConferenceEventMethod(CallbackMethodEnum conferenceEventMethod) { + this.conferenceEventMethod = conferenceEventMethod; + } + + + public Conference tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * The custom string attached to the conference that will be sent with callbacks. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public Conference activeMembers(List activeMembers) { + + this.activeMembers = activeMembers; + return this; + } + + public Conference addActiveMembersItem(ConferenceMember activeMembersItem) { + if (this.activeMembers == null) { + this.activeMembers = new ArrayList<>(); + } + this.activeMembers.add(activeMembersItem); + return this; + } + + /** + * A list of active members of the conference. Omitted if this is a response to the [Get Conferences endpoint](/apis/voice#tag/Conferences/operation/listConferences). + * @return activeMembers + **/ + @javax.annotation.Nullable + public List getActiveMembers() { + return activeMembers; + } + + + public void setActiveMembers(List activeMembers) { + this.activeMembers = activeMembers; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Conference instance itself + */ + public Conference putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Conference conference = (Conference) o; + return Objects.equals(this.id, conference.id) && + Objects.equals(this.name, conference.name) && + Objects.equals(this.createdTime, conference.createdTime) && + Objects.equals(this.completedTime, conference.completedTime) && + Objects.equals(this.conferenceEventUrl, conference.conferenceEventUrl) && + Objects.equals(this.conferenceEventMethod, conference.conferenceEventMethod) && + Objects.equals(this.tag, conference.tag) && + Objects.equals(this.activeMembers, conference.activeMembers)&& + Objects.equals(this.additionalProperties, conference.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, createdTime, completedTime, conferenceEventUrl, conferenceEventMethod, tag, activeMembers, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Conference {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); + sb.append(" completedTime: ").append(toIndentedString(completedTime)).append("\n"); + sb.append(" conferenceEventUrl: ").append(toIndentedString(conferenceEventUrl)).append("\n"); + sb.append(" conferenceEventMethod: ").append(toIndentedString(conferenceEventMethod)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" activeMembers: ").append(toIndentedString(activeMembers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("createdTime"); + openapiFields.add("completedTime"); + openapiFields.add("conferenceEventUrl"); + openapiFields.add("conferenceEventMethod"); + openapiFields.add("tag"); + openapiFields.add("activeMembers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Conference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Conference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Conference is not found in the empty JSON string", Conference.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("conferenceEventUrl") != null && !jsonObj.get("conferenceEventUrl").isJsonNull()) && !jsonObj.get("conferenceEventUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceEventUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceEventUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if (jsonObj.get("activeMembers") != null && !jsonObj.get("activeMembers").isJsonNull()) { + JsonArray jsonArrayactiveMembers = jsonObj.getAsJsonArray("activeMembers"); + if (jsonArrayactiveMembers != null) { + // ensure the json data is an array + if (!jsonObj.get("activeMembers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `activeMembers` to be an array in the JSON string but got `%s`", jsonObj.get("activeMembers").toString())); + } + + // validate the optional field `activeMembers` (array) + for (int i = 0; i < jsonArrayactiveMembers.size(); i++) { + ConferenceMember.validateJsonElement(jsonArrayactiveMembers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Conference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Conference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Conference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Conference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Conference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Conference instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Conference given an JSON string + * + * @param jsonString JSON string + * @return An instance of Conference + * @throws IOException if the JSON string is invalid with respect to Conference + */ + public static Conference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Conference.class); + } + + /** + * Convert an instance of Conference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java new file mode 100644 index 00000000..7eef1a85 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCompletedCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Completed event is fired when the last member leaves the conference. The response to this event may not contain BXML. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceCompletedCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public ConferenceCompletedCallback() { + } + + public ConferenceCompletedCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceCompletedCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceCompletedCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceCompletedCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceCompletedCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceCompletedCallback instance itself + */ + public ConferenceCompletedCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceCompletedCallback conferenceCompletedCallback = (ConferenceCompletedCallback) o; + return Objects.equals(this.eventType, conferenceCompletedCallback.eventType) && + Objects.equals(this.eventTime, conferenceCompletedCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceCompletedCallback.conferenceId) && + Objects.equals(this.name, conferenceCompletedCallback.name) && + Objects.equals(this.tag, conferenceCompletedCallback.tag)&& + Objects.equals(this.additionalProperties, conferenceCompletedCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceCompletedCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceCompletedCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceCompletedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceCompletedCallback is not found in the empty JSON string", ConferenceCompletedCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceCompletedCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceCompletedCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceCompletedCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceCompletedCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceCompletedCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceCompletedCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceCompletedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceCompletedCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceCompletedCallback + */ + public static ConferenceCompletedCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceCompletedCallback.class); + } + + /** + * Convert an instance of ConferenceCompletedCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java new file mode 100644 index 00000000..105c1a3d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceCreatedCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Created event is fired whenever a new conference that specified a callbackUrl is created. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceCreatedCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public ConferenceCreatedCallback() { + } + + public ConferenceCreatedCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceCreatedCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceCreatedCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceCreatedCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceCreatedCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceCreatedCallback instance itself + */ + public ConferenceCreatedCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceCreatedCallback conferenceCreatedCallback = (ConferenceCreatedCallback) o; + return Objects.equals(this.eventType, conferenceCreatedCallback.eventType) && + Objects.equals(this.eventTime, conferenceCreatedCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceCreatedCallback.conferenceId) && + Objects.equals(this.name, conferenceCreatedCallback.name) && + Objects.equals(this.tag, conferenceCreatedCallback.tag)&& + Objects.equals(this.additionalProperties, conferenceCreatedCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceCreatedCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceCreatedCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceCreatedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceCreatedCallback is not found in the empty JSON string", ConferenceCreatedCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceCreatedCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceCreatedCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceCreatedCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceCreatedCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceCreatedCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceCreatedCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceCreatedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceCreatedCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceCreatedCallback + */ + public static ConferenceCreatedCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceCreatedCallback.class); + } + + /** + * Convert an instance of ConferenceCreatedCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java new file mode 100644 index 00000000..f295364f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMember.java @@ -0,0 +1,457 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * ConferenceMember + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceMember { + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_MEMBER_URL = "memberUrl"; + @SerializedName(SERIALIZED_NAME_MEMBER_URL) + private String memberUrl; + + public static final String SERIALIZED_NAME_MUTE = "mute"; + @SerializedName(SERIALIZED_NAME_MUTE) + private Boolean mute; + + public static final String SERIALIZED_NAME_HOLD = "hold"; + @SerializedName(SERIALIZED_NAME_HOLD) + private Boolean hold; + + public static final String SERIALIZED_NAME_CALL_IDS_TO_COACH = "callIdsToCoach"; + @SerializedName(SERIALIZED_NAME_CALL_IDS_TO_COACH) + private List callIdsToCoach; + + public ConferenceMember() { + } + + public ConferenceMember callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public ConferenceMember conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceMember memberUrl(String memberUrl) { + + this.memberUrl = memberUrl; + return this; + } + + /** + * A URL that may be used to retrieve information about or update the state of this conference member. This is the URL of this member's [Get Conference Member](/apis/voice/#operation/getConferenceMember) endpoint and [Modify Conference Member](/apis/voice/#operation/updateConferenceMember) endpoint. + * @return memberUrl + **/ + @javax.annotation.Nullable + public String getMemberUrl() { + return memberUrl; + } + + + public void setMemberUrl(String memberUrl) { + this.memberUrl = memberUrl; + } + + + public ConferenceMember mute(Boolean mute) { + + this.mute = mute; + return this; + } + + /** + * Whether or not this member is currently muted. Members who are muted are still able to hear other participants. If used in a PUT request, updates this member's mute status. Has no effect if omitted. + * @return mute + **/ + @javax.annotation.Nullable + public Boolean getMute() { + return mute; + } + + + public void setMute(Boolean mute) { + this.mute = mute; + } + + + public ConferenceMember hold(Boolean hold) { + + this.hold = hold; + return this; + } + + /** + * Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. If used in a PUT request, updates this member's hold status. Has no effect if omitted. + * @return hold + **/ + @javax.annotation.Nullable + public Boolean getHold() { + return hold; + } + + + public void setHold(Boolean hold) { + this.hold = hold; + } + + + public ConferenceMember callIdsToCoach(List callIdsToCoach) { + + this.callIdsToCoach = callIdsToCoach; + return this; + } + + public ConferenceMember addCallIdsToCoachItem(String callIdsToCoachItem) { + if (this.callIdsToCoach == null) { + this.callIdsToCoach = new ArrayList<>(); + } + this.callIdsToCoach.add(callIdsToCoachItem); + return this; + } + + /** + * If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. If present in a PUT request, modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. + * @return callIdsToCoach + **/ + @javax.annotation.Nullable + public List getCallIdsToCoach() { + return callIdsToCoach; + } + + + public void setCallIdsToCoach(List callIdsToCoach) { + this.callIdsToCoach = callIdsToCoach; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceMember instance itself + */ + public ConferenceMember putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceMember conferenceMember = (ConferenceMember) o; + return Objects.equals(this.callId, conferenceMember.callId) && + Objects.equals(this.conferenceId, conferenceMember.conferenceId) && + Objects.equals(this.memberUrl, conferenceMember.memberUrl) && + Objects.equals(this.mute, conferenceMember.mute) && + Objects.equals(this.hold, conferenceMember.hold) && + Objects.equals(this.callIdsToCoach, conferenceMember.callIdsToCoach)&& + Objects.equals(this.additionalProperties, conferenceMember.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(callId, conferenceId, memberUrl, mute, hold, callIdsToCoach, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceMember {\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" memberUrl: ").append(toIndentedString(memberUrl)).append("\n"); + sb.append(" mute: ").append(toIndentedString(mute)).append("\n"); + sb.append(" hold: ").append(toIndentedString(hold)).append("\n"); + sb.append(" callIdsToCoach: ").append(toIndentedString(callIdsToCoach)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callId"); + openapiFields.add("conferenceId"); + openapiFields.add("memberUrl"); + openapiFields.add("mute"); + openapiFields.add("hold"); + openapiFields.add("callIdsToCoach"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceMember + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceMember.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceMember is not found in the empty JSON string", ConferenceMember.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("memberUrl") != null && !jsonObj.get("memberUrl").isJsonNull()) && !jsonObj.get("memberUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `memberUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("memberUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("callIdsToCoach") != null && !jsonObj.get("callIdsToCoach").isJsonNull() && !jsonObj.get("callIdsToCoach").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `callIdsToCoach` to be an array in the JSON string but got `%s`", jsonObj.get("callIdsToCoach").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceMember.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceMember' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceMember.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceMember value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceMember read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceMember instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceMember given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMember + * @throws IOException if the JSON string is invalid with respect to ConferenceMember + */ + public static ConferenceMember fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceMember.class); + } + + /** + * Convert an instance of ConferenceMember to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java new file mode 100644 index 00000000..043af9f2 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberExitCallback.java @@ -0,0 +1,512 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Member Exit event is fired whenever a caller exits a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceMemberExitCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public ConferenceMemberExitCallback() { + } + + public ConferenceMemberExitCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceMemberExitCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceMemberExitCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceMemberExitCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceMemberExitCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public ConferenceMemberExitCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public ConferenceMemberExitCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public ConferenceMemberExitCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceMemberExitCallback instance itself + */ + public ConferenceMemberExitCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceMemberExitCallback conferenceMemberExitCallback = (ConferenceMemberExitCallback) o; + return Objects.equals(this.eventType, conferenceMemberExitCallback.eventType) && + Objects.equals(this.eventTime, conferenceMemberExitCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceMemberExitCallback.conferenceId) && + Objects.equals(this.name, conferenceMemberExitCallback.name) && + Objects.equals(this.from, conferenceMemberExitCallback.from) && + Objects.equals(this.to, conferenceMemberExitCallback.to) && + Objects.equals(this.callId, conferenceMemberExitCallback.callId) && + Objects.equals(this.tag, conferenceMemberExitCallback.tag)&& + Objects.equals(this.additionalProperties, conferenceMemberExitCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, from, to, callId, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceMemberExitCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("callId"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceMemberExitCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceMemberExitCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceMemberExitCallback is not found in the empty JSON string", ConferenceMemberExitCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceMemberExitCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceMemberExitCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceMemberExitCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceMemberExitCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceMemberExitCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceMemberExitCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceMemberExitCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMemberExitCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceMemberExitCallback + */ + public static ConferenceMemberExitCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceMemberExitCallback.class); + } + + /** + * Convert an instance of ConferenceMemberExitCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java new file mode 100644 index 00000000..1dd8e26a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallback.java @@ -0,0 +1,512 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Member Join event is fired whenever a caller joins a conference that specified a callbackUrl. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceMemberJoinCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public ConferenceMemberJoinCallback() { + } + + public ConferenceMemberJoinCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceMemberJoinCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceMemberJoinCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceMemberJoinCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceMemberJoinCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public ConferenceMemberJoinCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public ConferenceMemberJoinCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public ConferenceMemberJoinCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceMemberJoinCallback instance itself + */ + public ConferenceMemberJoinCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceMemberJoinCallback conferenceMemberJoinCallback = (ConferenceMemberJoinCallback) o; + return Objects.equals(this.eventType, conferenceMemberJoinCallback.eventType) && + Objects.equals(this.eventTime, conferenceMemberJoinCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceMemberJoinCallback.conferenceId) && + Objects.equals(this.name, conferenceMemberJoinCallback.name) && + Objects.equals(this.from, conferenceMemberJoinCallback.from) && + Objects.equals(this.to, conferenceMemberJoinCallback.to) && + Objects.equals(this.callId, conferenceMemberJoinCallback.callId) && + Objects.equals(this.tag, conferenceMemberJoinCallback.tag)&& + Objects.equals(this.additionalProperties, conferenceMemberJoinCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, from, to, callId, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceMemberJoinCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("callId"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceMemberJoinCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceMemberJoinCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceMemberJoinCallback is not found in the empty JSON string", ConferenceMemberJoinCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceMemberJoinCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceMemberJoinCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceMemberJoinCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceMemberJoinCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceMemberJoinCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceMemberJoinCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceMemberJoinCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceMemberJoinCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceMemberJoinCallback + */ + public static ConferenceMemberJoinCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceMemberJoinCallback.class); + } + + /** + * Convert an instance of ConferenceMemberJoinCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java new file mode 100644 index 00000000..3688450d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallback.java @@ -0,0 +1,688 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Recording Available event is sent after a conference recording has been processed. It indicates that the recording is available for download. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceRecordingAvailableCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_CHANNELS = "channels"; + @SerializedName(SERIALIZED_NAME_CHANNELS) + private Integer channels; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public ConferenceRecordingAvailableCallback() { + } + + public ConferenceRecordingAvailableCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceRecordingAvailableCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceRecordingAvailableCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceRecordingAvailableCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceRecordingAvailableCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ConferenceRecordingAvailableCallback recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public ConferenceRecordingAvailableCallback channels(Integer channels) { + + this.channels = channels; + return this; + } + + /** + * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * @return channels + **/ + @javax.annotation.Nullable + public Integer getChannels() { + return channels; + } + + + public void setChannels(Integer channels) { + this.channels = channels; + } + + + public ConferenceRecordingAvailableCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public ConferenceRecordingAvailableCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public ConferenceRecordingAvailableCallback duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public ConferenceRecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public ConferenceRecordingAvailableCallback mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public ConferenceRecordingAvailableCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public ConferenceRecordingAvailableCallback status(String status) { + + this.status = status; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceRecordingAvailableCallback instance itself + */ + public ConferenceRecordingAvailableCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceRecordingAvailableCallback conferenceRecordingAvailableCallback = (ConferenceRecordingAvailableCallback) o; + return Objects.equals(this.eventType, conferenceRecordingAvailableCallback.eventType) && + Objects.equals(this.eventTime, conferenceRecordingAvailableCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceRecordingAvailableCallback.conferenceId) && + Objects.equals(this.name, conferenceRecordingAvailableCallback.name) && + Objects.equals(this.accountId, conferenceRecordingAvailableCallback.accountId) && + Objects.equals(this.recordingId, conferenceRecordingAvailableCallback.recordingId) && + Objects.equals(this.channels, conferenceRecordingAvailableCallback.channels) && + Objects.equals(this.startTime, conferenceRecordingAvailableCallback.startTime) && + Objects.equals(this.endTime, conferenceRecordingAvailableCallback.endTime) && + Objects.equals(this.duration, conferenceRecordingAvailableCallback.duration) && + Objects.equals(this.fileFormat, conferenceRecordingAvailableCallback.fileFormat) && + Objects.equals(this.mediaUrl, conferenceRecordingAvailableCallback.mediaUrl) && + Objects.equals(this.tag, conferenceRecordingAvailableCallback.tag) && + Objects.equals(this.status, conferenceRecordingAvailableCallback.status)&& + Objects.equals(this.additionalProperties, conferenceRecordingAvailableCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, accountId, recordingId, channels, startTime, endTime, duration, fileFormat, mediaUrl, tag, status, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceRecordingAvailableCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("accountId"); + openapiFields.add("recordingId"); + openapiFields.add("channels"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("duration"); + openapiFields.add("fileFormat"); + openapiFields.add("mediaUrl"); + openapiFields.add("tag"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceRecordingAvailableCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceRecordingAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceRecordingAvailableCallback is not found in the empty JSON string", ConferenceRecordingAvailableCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceRecordingAvailableCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceRecordingAvailableCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceRecordingAvailableCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceRecordingAvailableCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceRecordingAvailableCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceRecordingAvailableCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceRecordingAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRecordingAvailableCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingAvailableCallback + */ + public static ConferenceRecordingAvailableCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceRecordingAvailableCallback.class); + } + + /** + * Convert an instance of ConferenceRecordingAvailableCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java new file mode 100644 index 00000000..24b7542b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRecordingMetadata.java @@ -0,0 +1,598 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * ConferenceRecordingMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceRecordingMetadata { + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_CHANNELS = "channels"; + @SerializedName(SERIALIZED_NAME_CHANNELS) + private Integer channels; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public ConferenceRecordingMetadata() { + } + + public ConferenceRecordingMetadata accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ConferenceRecordingMetadata conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceRecordingMetadata name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceRecordingMetadata recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public ConferenceRecordingMetadata duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public ConferenceRecordingMetadata channels(Integer channels) { + + this.channels = channels; + return this; + } + + /** + * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * @return channels + **/ + @javax.annotation.Nullable + public Integer getChannels() { + return channels; + } + + + public void setChannels(Integer channels) { + this.channels = channels; + } + + + public ConferenceRecordingMetadata startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public ConferenceRecordingMetadata endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public ConferenceRecordingMetadata fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public ConferenceRecordingMetadata status(String status) { + + this.status = status; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public ConferenceRecordingMetadata mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceRecordingMetadata instance itself + */ + public ConferenceRecordingMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceRecordingMetadata conferenceRecordingMetadata = (ConferenceRecordingMetadata) o; + return Objects.equals(this.accountId, conferenceRecordingMetadata.accountId) && + Objects.equals(this.conferenceId, conferenceRecordingMetadata.conferenceId) && + Objects.equals(this.name, conferenceRecordingMetadata.name) && + Objects.equals(this.recordingId, conferenceRecordingMetadata.recordingId) && + Objects.equals(this.duration, conferenceRecordingMetadata.duration) && + Objects.equals(this.channels, conferenceRecordingMetadata.channels) && + Objects.equals(this.startTime, conferenceRecordingMetadata.startTime) && + Objects.equals(this.endTime, conferenceRecordingMetadata.endTime) && + Objects.equals(this.fileFormat, conferenceRecordingMetadata.fileFormat) && + Objects.equals(this.status, conferenceRecordingMetadata.status) && + Objects.equals(this.mediaUrl, conferenceRecordingMetadata.mediaUrl)&& + Objects.equals(this.additionalProperties, conferenceRecordingMetadata.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, conferenceId, name, recordingId, duration, channels, startTime, endTime, fileFormat, status, mediaUrl, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceRecordingMetadata {\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("accountId"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("recordingId"); + openapiFields.add("duration"); + openapiFields.add("channels"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("fileFormat"); + openapiFields.add("status"); + openapiFields.add("mediaUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceRecordingMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceRecordingMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceRecordingMetadata is not found in the empty JSON string", ConferenceRecordingMetadata.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceRecordingMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceRecordingMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceRecordingMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceRecordingMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceRecordingMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceRecordingMetadata instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceRecordingMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRecordingMetadata + * @throws IOException if the JSON string is invalid with respect to ConferenceRecordingMetadata + */ + public static ConferenceRecordingMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceRecordingMetadata.class); + } + + /** + * Convert an instance of ConferenceRecordingMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java new file mode 100644 index 00000000..a915b917 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceRedirectCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Conference Redirect event is fired whenever an existing conference is modified via a POST request made to the /conferences/{conferenceId} endpoint. The response may be either empty or a BXML document. Only the following verbs are valid for conferences: PlayAudio, SpeakSentence, StartRecording, StopRecording, PauseRecording, ResumeRecording. Audio verbs will be heard by all members of the conference. Recordings capture audio from all members who are not muted or on hold, as well as any audio verbs that are played into the conference. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ConferenceRedirectCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_CONFERENCE_ID = "conferenceId"; + @SerializedName(SERIALIZED_NAME_CONFERENCE_ID) + private String conferenceId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public ConferenceRedirectCallback() { + } + + public ConferenceRedirectCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public ConferenceRedirectCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public ConferenceRedirectCallback conferenceId(String conferenceId) { + + this.conferenceId = conferenceId; + return this; + } + + /** + * The unique, Bandwidth-generated ID of the conference that was recorded + * @return conferenceId + **/ + @javax.annotation.Nullable + public String getConferenceId() { + return conferenceId; + } + + + public void setConferenceId(String conferenceId) { + this.conferenceId = conferenceId; + } + + + public ConferenceRedirectCallback name(String name) { + + this.name = name; + return this; + } + + /** + * The user-specified name of the conference that was recorded + * @return name + **/ + @javax.annotation.Nullable + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public ConferenceRedirectCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConferenceRedirectCallback instance itself + */ + public ConferenceRedirectCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConferenceRedirectCallback conferenceRedirectCallback = (ConferenceRedirectCallback) o; + return Objects.equals(this.eventType, conferenceRedirectCallback.eventType) && + Objects.equals(this.eventTime, conferenceRedirectCallback.eventTime) && + Objects.equals(this.conferenceId, conferenceRedirectCallback.conferenceId) && + Objects.equals(this.name, conferenceRedirectCallback.name) && + Objects.equals(this.tag, conferenceRedirectCallback.tag)&& + Objects.equals(this.additionalProperties, conferenceRedirectCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, conferenceId, name, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConferenceRedirectCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" conferenceId: ").append(toIndentedString(conferenceId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("conferenceId"); + openapiFields.add("name"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConferenceRedirectCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConferenceRedirectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConferenceRedirectCallback is not found in the empty JSON string", ConferenceRedirectCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("conferenceId") != null && !jsonObj.get("conferenceId").isJsonNull()) && !jsonObj.get("conferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `conferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("conferenceId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConferenceRedirectCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConferenceRedirectCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConferenceRedirectCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConferenceRedirectCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConferenceRedirectCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConferenceRedirectCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConferenceRedirectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConferenceRedirectCallback + * @throws IOException if the JSON string is invalid with respect to ConferenceRedirectCallback + */ + public static ConferenceRedirectCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConferenceRedirectCallback.class); + } + + /** + * Convert an instance of ConferenceRedirectCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java new file mode 100644 index 00000000..91161993 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ConferenceStateEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Setting the conference state to `completed` ends the conference and ejects all members. + */ +@JsonAdapter(ConferenceStateEnum.Adapter.class) +public enum ConferenceStateEnum { + + ACTIVE("active"), + + COMPLETED("completed"); + + private String value; + + ConferenceStateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ConferenceStateEnum fromValue(String value) { + for (ConferenceStateEnum b : ConferenceStateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ConferenceStateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ConferenceStateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ConferenceStateEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCall.java b/src/main/java/com/bandwidth/sdk/model/CreateCall.java new file mode 100644 index 00000000..8b023fbc --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateCall.java @@ -0,0 +1,889 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.MachineDetectionConfiguration; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CreateCall + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CreateCall { + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + + public static final String SERIALIZED_NAME_UUI = "uui"; + @SerializedName(SERIALIZED_NAME_UUI) + private String uui; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_ANSWER_URL = "answerUrl"; + @SerializedName(SERIALIZED_NAME_ANSWER_URL) + private URI answerUrl; + + public static final String SERIALIZED_NAME_ANSWER_METHOD = "answerMethod"; + @SerializedName(SERIALIZED_NAME_ANSWER_METHOD) + private CallbackMethodEnum answerMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_ANSWER_FALLBACK_URL = "answerFallbackUrl"; + @SerializedName(SERIALIZED_NAME_ANSWER_FALLBACK_URL) + private URI answerFallbackUrl; + + public static final String SERIALIZED_NAME_ANSWER_FALLBACK_METHOD = "answerFallbackMethod"; + @SerializedName(SERIALIZED_NAME_ANSWER_FALLBACK_METHOD) + private CallbackMethodEnum answerFallbackMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_FALLBACK_USERNAME = "fallbackUsername"; + @SerializedName(SERIALIZED_NAME_FALLBACK_USERNAME) + private String fallbackUsername; + + public static final String SERIALIZED_NAME_FALLBACK_PASSWORD = "fallbackPassword"; + @SerializedName(SERIALIZED_NAME_FALLBACK_PASSWORD) + private String fallbackPassword; + + public static final String SERIALIZED_NAME_DISCONNECT_URL = "disconnectUrl"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_URL) + private URI disconnectUrl; + + public static final String SERIALIZED_NAME_DISCONNECT_METHOD = "disconnectMethod"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_METHOD) + private CallbackMethodEnum disconnectMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_CALL_TIMEOUT = "callTimeout"; + @SerializedName(SERIALIZED_NAME_CALL_TIMEOUT) + private Double callTimeout = 30d; + + public static final String SERIALIZED_NAME_CALLBACK_TIMEOUT = "callbackTimeout"; + @SerializedName(SERIALIZED_NAME_CALLBACK_TIMEOUT) + private Double callbackTimeout = 15d; + + public static final String SERIALIZED_NAME_MACHINE_DETECTION = "machineDetection"; + @SerializedName(SERIALIZED_NAME_MACHINE_DETECTION) + private MachineDetectionConfiguration machineDetection; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private Integer priority = 5; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public CreateCall() { + } + + public CreateCall to(String to) { + + this.to = to; + return this; + } + + /** + * The destination to call (must be an E.164 formatted number (e.g. `+15555551212`) or a SIP URI (e.g. `sip:user@server.example`)). + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public CreateCall from(String from) { + + this.from = from; + return this; + } + + /** + * A Bandwidth phone number on your account the call should come from (must be in E.164 format, like `+15555551212`, or be one of the following strings: `Restricted`, `Anonymous`, `Private`, or `Unavailable`). + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public CreateCall displayName(String displayName) { + + this.displayName = displayName; + return this; + } + + /** + * The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. + * @return displayName + **/ + @javax.annotation.Nullable + public String getDisplayName() { + return displayName; + } + + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + + public CreateCall uui(String uui) { + + this.uui = uui; + return this; + } + + /** + * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP URI. Each value must end with an 'encoding' parameter as described in <a href='https://tools.ietf.org/html/rfc7433'>RFC 7433</a>. Only 'jwt' and 'base64' encodings are allowed. The entire value cannot exceed 350 characters, including parameters and separators. + * @return uui + **/ + @javax.annotation.Nullable + public String getUui() { + return uui; + } + + + public void setUui(String uui) { + this.uui = uui; + } + + + public CreateCall applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the `from` number. + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public CreateCall answerUrl(URI answerUrl) { + + this.answerUrl = answerUrl; + return this; + } + + /** + * The full URL to send the <a href='/docs/voice/webhooks/answer'>Answer</a> event to when the called party answers. This endpoint should return the first <a href='/docs/voice/bxml'>BXML document</a> to be executed in the call. Must use `https` if specifying `username` and `password`. + * @return answerUrl + **/ + @javax.annotation.Nonnull + public URI getAnswerUrl() { + return answerUrl; + } + + + public void setAnswerUrl(URI answerUrl) { + this.answerUrl = answerUrl; + } + + + public CreateCall answerMethod(CallbackMethodEnum answerMethod) { + + this.answerMethod = answerMethod; + return this; + } + + /** + * Get answerMethod + * @return answerMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getAnswerMethod() { + return answerMethod; + } + + + public void setAnswerMethod(CallbackMethodEnum answerMethod) { + this.answerMethod = answerMethod; + } + + + public CreateCall username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public CreateCall password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public CreateCall answerFallbackUrl(URI answerFallbackUrl) { + + this.answerFallbackUrl = answerFallbackUrl; + return this; + } + + /** + * A fallback url which, if provided, will be used to retry the `answer` webhook delivery in case `answerUrl` fails to respond Must use `https` if specifying `fallbackUsername` and `fallbackPassword`. + * @return answerFallbackUrl + **/ + @javax.annotation.Nullable + public URI getAnswerFallbackUrl() { + return answerFallbackUrl; + } + + + public void setAnswerFallbackUrl(URI answerFallbackUrl) { + this.answerFallbackUrl = answerFallbackUrl; + } + + + public CreateCall answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + + this.answerFallbackMethod = answerFallbackMethod; + return this; + } + + /** + * Get answerFallbackMethod + * @return answerFallbackMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getAnswerFallbackMethod() { + return answerFallbackMethod; + } + + + public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + this.answerFallbackMethod = answerFallbackMethod; + } + + + public CreateCall fallbackUsername(String fallbackUsername) { + + this.fallbackUsername = fallbackUsername; + return this; + } + + /** + * Basic auth username. + * @return fallbackUsername + **/ + @javax.annotation.Nullable + public String getFallbackUsername() { + return fallbackUsername; + } + + + public void setFallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; + } + + + public CreateCall fallbackPassword(String fallbackPassword) { + + this.fallbackPassword = fallbackPassword; + return this; + } + + /** + * Basic auth password. + * @return fallbackPassword + **/ + @javax.annotation.Nullable + public String getFallbackPassword() { + return fallbackPassword; + } + + + public void setFallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; + } + + + public CreateCall disconnectUrl(URI disconnectUrl) { + + this.disconnectUrl = disconnectUrl; + return this; + } + + /** + * The URL to send the <a href='/docs/voice/webhooks/disconnect'>Disconnect</a> event to when the call ends. This event does not expect a BXML response. + * @return disconnectUrl + **/ + @javax.annotation.Nullable + public URI getDisconnectUrl() { + return disconnectUrl; + } + + + public void setDisconnectUrl(URI disconnectUrl) { + this.disconnectUrl = disconnectUrl; + } + + + public CreateCall disconnectMethod(CallbackMethodEnum disconnectMethod) { + + this.disconnectMethod = disconnectMethod; + return this; + } + + /** + * Get disconnectMethod + * @return disconnectMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getDisconnectMethod() { + return disconnectMethod; + } + + + public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { + this.disconnectMethod = disconnectMethod; + } + + + public CreateCall callTimeout(Double callTimeout) { + + this.callTimeout = callTimeout; + return this; + } + + /** + * The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Can be any numeric value (including decimals) between 1 and 300. + * minimum: 1 + * maximum: 300 + * @return callTimeout + **/ + @javax.annotation.Nullable + public Double getCallTimeout() { + return callTimeout; + } + + + public void setCallTimeout(Double callTimeout) { + this.callTimeout = callTimeout; + } + + + public CreateCall callbackTimeout(Double callbackTimeout) { + + this.callbackTimeout = callbackTimeout; + return this; + } + + /** + * This is the timeout (in seconds) to use when delivering webhooks for the call. Can be any numeric value (including decimals) between 1 and 25. + * minimum: 1 + * maximum: 25 + * @return callbackTimeout + **/ + @javax.annotation.Nullable + public Double getCallbackTimeout() { + return callbackTimeout; + } + + + public void setCallbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; + } + + + public CreateCall machineDetection(MachineDetectionConfiguration machineDetection) { + + this.machineDetection = machineDetection; + return this; + } + + /** + * Get machineDetection + * @return machineDetection + **/ + @javax.annotation.Nullable + public MachineDetectionConfiguration getMachineDetection() { + return machineDetection; + } + + + public void setMachineDetection(MachineDetectionConfiguration machineDetection) { + this.machineDetection = machineDetection; + } + + + public CreateCall priority(Integer priority) { + + this.priority = priority; + return this; + } + + /** + * The priority of this call over other calls from your account. For example, if during a call your application needs to place a new call and bridge it with the current call, you might want to create the call with priority 1 so that it will be the next call picked off your queue, ahead of other less time sensitive calls. A lower value means higher priority, so a priority 1 call takes precedence over a priority 2 call. + * minimum: 1 + * maximum: 5 + * @return priority + **/ + @javax.annotation.Nullable + public Integer getPriority() { + return priority; + } + + + public void setPriority(Integer priority) { + this.priority = priority; + } + + + public CreateCall tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * A custom string that will be sent with all webhooks for this call unless overwritten by a future <a href='/docs/voice/bxml/tag'>`<Tag>`</a> verb or `tag` attribute on another verb, or cleared. May be cleared by setting `tag=\"\"` Max length 256 characters. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateCall instance itself + */ + public CreateCall putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCall createCall = (CreateCall) o; + return Objects.equals(this.to, createCall.to) && + Objects.equals(this.from, createCall.from) && + Objects.equals(this.displayName, createCall.displayName) && + Objects.equals(this.uui, createCall.uui) && + Objects.equals(this.applicationId, createCall.applicationId) && + Objects.equals(this.answerUrl, createCall.answerUrl) && + Objects.equals(this.answerMethod, createCall.answerMethod) && + Objects.equals(this.username, createCall.username) && + Objects.equals(this.password, createCall.password) && + Objects.equals(this.answerFallbackUrl, createCall.answerFallbackUrl) && + Objects.equals(this.answerFallbackMethod, createCall.answerFallbackMethod) && + Objects.equals(this.fallbackUsername, createCall.fallbackUsername) && + Objects.equals(this.fallbackPassword, createCall.fallbackPassword) && + Objects.equals(this.disconnectUrl, createCall.disconnectUrl) && + Objects.equals(this.disconnectMethod, createCall.disconnectMethod) && + Objects.equals(this.callTimeout, createCall.callTimeout) && + Objects.equals(this.callbackTimeout, createCall.callbackTimeout) && + Objects.equals(this.machineDetection, createCall.machineDetection) && + Objects.equals(this.priority, createCall.priority) && + Objects.equals(this.tag, createCall.tag)&& + Objects.equals(this.additionalProperties, createCall.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(to, from, displayName, uui, applicationId, answerUrl, answerMethod, username, password, answerFallbackUrl, answerFallbackMethod, fallbackUsername, fallbackPassword, disconnectUrl, disconnectMethod, callTimeout, callbackTimeout, machineDetection, priority, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCall {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" uui: ").append(toIndentedString(uui)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" answerUrl: ").append(toIndentedString(answerUrl)).append("\n"); + sb.append(" answerMethod: ").append(toIndentedString(answerMethod)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" answerFallbackUrl: ").append(toIndentedString(answerFallbackUrl)).append("\n"); + sb.append(" answerFallbackMethod: ").append(toIndentedString(answerFallbackMethod)).append("\n"); + sb.append(" fallbackUsername: ").append(toIndentedString(fallbackUsername)).append("\n"); + sb.append(" fallbackPassword: ").append(toIndentedString(fallbackPassword)).append("\n"); + sb.append(" disconnectUrl: ").append(toIndentedString(disconnectUrl)).append("\n"); + sb.append(" disconnectMethod: ").append(toIndentedString(disconnectMethod)).append("\n"); + sb.append(" callTimeout: ").append(toIndentedString(callTimeout)).append("\n"); + sb.append(" callbackTimeout: ").append(toIndentedString(callbackTimeout)).append("\n"); + sb.append(" machineDetection: ").append(toIndentedString(machineDetection)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("displayName"); + openapiFields.add("uui"); + openapiFields.add("applicationId"); + openapiFields.add("answerUrl"); + openapiFields.add("answerMethod"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("answerFallbackUrl"); + openapiFields.add("answerFallbackMethod"); + openapiFields.add("fallbackUsername"); + openapiFields.add("fallbackPassword"); + openapiFields.add("disconnectUrl"); + openapiFields.add("disconnectMethod"); + openapiFields.add("callTimeout"); + openapiFields.add("callbackTimeout"); + openapiFields.add("machineDetection"); + openapiFields.add("priority"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("answerUrl"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCall + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCall is not found in the empty JSON string", CreateCall.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCall.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("displayName") != null && !jsonObj.get("displayName").isJsonNull()) && !jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); + } + if ((jsonObj.get("uui") != null && !jsonObj.get("uui").isJsonNull()) && !jsonObj.get("uui").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uui` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uui").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if (!jsonObj.get("answerUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `answerUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("answerFallbackUrl") != null && !jsonObj.get("answerFallbackUrl").isJsonNull()) && !jsonObj.get("answerFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `answerFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerFallbackUrl").toString())); + } + if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); + } + if ((jsonObj.get("fallbackPassword") != null && !jsonObj.get("fallbackPassword").isJsonNull()) && !jsonObj.get("fallbackPassword").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackPassword` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackPassword").toString())); + } + if ((jsonObj.get("disconnectUrl") != null && !jsonObj.get("disconnectUrl").isJsonNull()) && !jsonObj.get("disconnectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `disconnectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disconnectUrl").toString())); + } + // validate the optional field `machineDetection` + if (jsonObj.get("machineDetection") != null && !jsonObj.get("machineDetection").isJsonNull()) { + MachineDetectionConfiguration.validateJsonElement(jsonObj.get("machineDetection")); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCall.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCall' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCall.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCall value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateCall read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateCall instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCall + * @throws IOException if the JSON string is invalid with respect to CreateCall + */ + public static CreateCall fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCall.class); + } + + /** + * Convert an instance of CreateCall to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java new file mode 100644 index 00000000..e7b5a0ef --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateCallResponse.java @@ -0,0 +1,915 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CreateCallResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CreateCallResponse { + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private URI callUrl; + + public static final String SERIALIZED_NAME_CALL_TIMEOUT = "callTimeout"; + @SerializedName(SERIALIZED_NAME_CALL_TIMEOUT) + private Double callTimeout; + + public static final String SERIALIZED_NAME_CALLBACK_TIMEOUT = "callbackTimeout"; + @SerializedName(SERIALIZED_NAME_CALLBACK_TIMEOUT) + private Double callbackTimeout; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_ANSWER_METHOD = "answerMethod"; + @SerializedName(SERIALIZED_NAME_ANSWER_METHOD) + private CallbackMethodEnum answerMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_ANSWER_URL = "answerUrl"; + @SerializedName(SERIALIZED_NAME_ANSWER_URL) + private URI answerUrl; + + public static final String SERIALIZED_NAME_ANSWER_FALLBACK_METHOD = "answerFallbackMethod"; + @SerializedName(SERIALIZED_NAME_ANSWER_FALLBACK_METHOD) + private CallbackMethodEnum answerFallbackMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_ANSWER_FALLBACK_URL = "answerFallbackUrl"; + @SerializedName(SERIALIZED_NAME_ANSWER_FALLBACK_URL) + private URI answerFallbackUrl; + + public static final String SERIALIZED_NAME_DISCONNECT_METHOD = "disconnectMethod"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_METHOD) + private CallbackMethodEnum disconnectMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_DISCONNECT_URL = "disconnectUrl"; + @SerializedName(SERIALIZED_NAME_DISCONNECT_URL) + private URI disconnectUrl; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_FALLBACK_USERNAME = "fallbackUsername"; + @SerializedName(SERIALIZED_NAME_FALLBACK_USERNAME) + private String fallbackUsername; + + public static final String SERIALIZED_NAME_FALLBACK_PASSWORD = "fallbackPassword"; + @SerializedName(SERIALIZED_NAME_FALLBACK_PASSWORD) + private String fallbackPassword; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private Integer priority; + + public CreateCallResponse() { + } + + public CreateCallResponse applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the `from` number. + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public CreateCallResponse accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The bandwidth account ID associated with the call. + * @return accountId + **/ + @javax.annotation.Nonnull + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public CreateCallResponse callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * Programmable Voice API Call ID. + * @return callId + **/ + @javax.annotation.Nonnull + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public CreateCallResponse to(String to) { + + this.to = to; + return this; + } + + /** + * Recipient of the outgoing call. + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public CreateCallResponse from(String from) { + + this.from = from; + return this; + } + + /** + * Phone number that created the outbound call. + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public CreateCallResponse enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * The time at which the call was accepted into the queue. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public CreateCallResponse callUrl(URI callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL to update this call's state. + * @return callUrl + **/ + @javax.annotation.Nonnull + public URI getCallUrl() { + return callUrl; + } + + + public void setCallUrl(URI callUrl) { + this.callUrl = callUrl; + } + + + public CreateCallResponse callTimeout(Double callTimeout) { + + this.callTimeout = callTimeout; + return this; + } + + /** + * The timeout (in seconds) for the callee to answer the call after it starts ringing. + * @return callTimeout + **/ + @javax.annotation.Nullable + public Double getCallTimeout() { + return callTimeout; + } + + + public void setCallTimeout(Double callTimeout) { + this.callTimeout = callTimeout; + } + + + public CreateCallResponse callbackTimeout(Double callbackTimeout) { + + this.callbackTimeout = callbackTimeout; + return this; + } + + /** + * This is the timeout (in seconds) to use when delivering webhooks for the call. + * @return callbackTimeout + **/ + @javax.annotation.Nullable + public Double getCallbackTimeout() { + return callbackTimeout; + } + + + public void setCallbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; + } + + + public CreateCallResponse tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * Custom tag value. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public CreateCallResponse answerMethod(CallbackMethodEnum answerMethod) { + + this.answerMethod = answerMethod; + return this; + } + + /** + * Get answerMethod + * @return answerMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getAnswerMethod() { + return answerMethod; + } + + + public void setAnswerMethod(CallbackMethodEnum answerMethod) { + this.answerMethod = answerMethod; + } + + + public CreateCallResponse answerUrl(URI answerUrl) { + + this.answerUrl = answerUrl; + return this; + } + + /** + * URL to deliver the `answer` event webhook. + * @return answerUrl + **/ + @javax.annotation.Nonnull + public URI getAnswerUrl() { + return answerUrl; + } + + + public void setAnswerUrl(URI answerUrl) { + this.answerUrl = answerUrl; + } + + + public CreateCallResponse answerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + + this.answerFallbackMethod = answerFallbackMethod; + return this; + } + + /** + * Get answerFallbackMethod + * @return answerFallbackMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getAnswerFallbackMethod() { + return answerFallbackMethod; + } + + + public void setAnswerFallbackMethod(CallbackMethodEnum answerFallbackMethod) { + this.answerFallbackMethod = answerFallbackMethod; + } + + + public CreateCallResponse answerFallbackUrl(URI answerFallbackUrl) { + + this.answerFallbackUrl = answerFallbackUrl; + return this; + } + + /** + * Fallback URL to deliver the `answer` event webhook. + * @return answerFallbackUrl + **/ + @javax.annotation.Nullable + public URI getAnswerFallbackUrl() { + return answerFallbackUrl; + } + + + public void setAnswerFallbackUrl(URI answerFallbackUrl) { + this.answerFallbackUrl = answerFallbackUrl; + } + + + public CreateCallResponse disconnectMethod(CallbackMethodEnum disconnectMethod) { + + this.disconnectMethod = disconnectMethod; + return this; + } + + /** + * Get disconnectMethod + * @return disconnectMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getDisconnectMethod() { + return disconnectMethod; + } + + + public void setDisconnectMethod(CallbackMethodEnum disconnectMethod) { + this.disconnectMethod = disconnectMethod; + } + + + public CreateCallResponse disconnectUrl(URI disconnectUrl) { + + this.disconnectUrl = disconnectUrl; + return this; + } + + /** + * URL to deliver the `disconnect` event webhook. + * @return disconnectUrl + **/ + @javax.annotation.Nullable + public URI getDisconnectUrl() { + return disconnectUrl; + } + + + public void setDisconnectUrl(URI disconnectUrl) { + this.disconnectUrl = disconnectUrl; + } + + + public CreateCallResponse username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public CreateCallResponse password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public CreateCallResponse fallbackUsername(String fallbackUsername) { + + this.fallbackUsername = fallbackUsername; + return this; + } + + /** + * Basic auth username. + * @return fallbackUsername + **/ + @javax.annotation.Nullable + public String getFallbackUsername() { + return fallbackUsername; + } + + + public void setFallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; + } + + + public CreateCallResponse fallbackPassword(String fallbackPassword) { + + this.fallbackPassword = fallbackPassword; + return this; + } + + /** + * Basic auth password. + * @return fallbackPassword + **/ + @javax.annotation.Nullable + public String getFallbackPassword() { + return fallbackPassword; + } + + + public void setFallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; + } + + + public CreateCallResponse priority(Integer priority) { + + this.priority = priority; + return this; + } + + /** + * The priority of this call over other calls from your account. + * @return priority + **/ + @javax.annotation.Nullable + public Integer getPriority() { + return priority; + } + + + public void setPriority(Integer priority) { + this.priority = priority; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateCallResponse instance itself + */ + public CreateCallResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateCallResponse createCallResponse = (CreateCallResponse) o; + return Objects.equals(this.applicationId, createCallResponse.applicationId) && + Objects.equals(this.accountId, createCallResponse.accountId) && + Objects.equals(this.callId, createCallResponse.callId) && + Objects.equals(this.to, createCallResponse.to) && + Objects.equals(this.from, createCallResponse.from) && + Objects.equals(this.enqueuedTime, createCallResponse.enqueuedTime) && + Objects.equals(this.callUrl, createCallResponse.callUrl) && + Objects.equals(this.callTimeout, createCallResponse.callTimeout) && + Objects.equals(this.callbackTimeout, createCallResponse.callbackTimeout) && + Objects.equals(this.tag, createCallResponse.tag) && + Objects.equals(this.answerMethod, createCallResponse.answerMethod) && + Objects.equals(this.answerUrl, createCallResponse.answerUrl) && + Objects.equals(this.answerFallbackMethod, createCallResponse.answerFallbackMethod) && + Objects.equals(this.answerFallbackUrl, createCallResponse.answerFallbackUrl) && + Objects.equals(this.disconnectMethod, createCallResponse.disconnectMethod) && + Objects.equals(this.disconnectUrl, createCallResponse.disconnectUrl) && + Objects.equals(this.username, createCallResponse.username) && + Objects.equals(this.password, createCallResponse.password) && + Objects.equals(this.fallbackUsername, createCallResponse.fallbackUsername) && + Objects.equals(this.fallbackPassword, createCallResponse.fallbackPassword) && + Objects.equals(this.priority, createCallResponse.priority)&& + Objects.equals(this.additionalProperties, createCallResponse.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, accountId, callId, to, from, enqueuedTime, callUrl, callTimeout, callbackTimeout, tag, answerMethod, answerUrl, answerFallbackMethod, answerFallbackUrl, disconnectMethod, disconnectUrl, username, password, fallbackUsername, fallbackPassword, priority, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateCallResponse {\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" callTimeout: ").append(toIndentedString(callTimeout)).append("\n"); + sb.append(" callbackTimeout: ").append(toIndentedString(callbackTimeout)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" answerMethod: ").append(toIndentedString(answerMethod)).append("\n"); + sb.append(" answerUrl: ").append(toIndentedString(answerUrl)).append("\n"); + sb.append(" answerFallbackMethod: ").append(toIndentedString(answerFallbackMethod)).append("\n"); + sb.append(" answerFallbackUrl: ").append(toIndentedString(answerFallbackUrl)).append("\n"); + sb.append(" disconnectMethod: ").append(toIndentedString(disconnectMethod)).append("\n"); + sb.append(" disconnectUrl: ").append(toIndentedString(disconnectUrl)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" fallbackUsername: ").append(toIndentedString(fallbackUsername)).append("\n"); + sb.append(" fallbackPassword: ").append(toIndentedString(fallbackPassword)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicationId"); + openapiFields.add("accountId"); + openapiFields.add("callId"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("enqueuedTime"); + openapiFields.add("callUrl"); + openapiFields.add("callTimeout"); + openapiFields.add("callbackTimeout"); + openapiFields.add("tag"); + openapiFields.add("answerMethod"); + openapiFields.add("answerUrl"); + openapiFields.add("answerFallbackMethod"); + openapiFields.add("answerFallbackUrl"); + openapiFields.add("disconnectMethod"); + openapiFields.add("disconnectUrl"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("fallbackUsername"); + openapiFields.add("fallbackPassword"); + openapiFields.add("priority"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("accountId"); + openapiRequiredFields.add("callId"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("callUrl"); + openapiRequiredFields.add("answerMethod"); + openapiRequiredFields.add("answerUrl"); + openapiRequiredFields.add("disconnectMethod"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateCallResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateCallResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateCallResponse is not found in the empty JSON string", CreateCallResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateCallResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if (!jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if (!jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if (!jsonObj.get("answerUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `answerUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerUrl").toString())); + } + if ((jsonObj.get("answerFallbackUrl") != null && !jsonObj.get("answerFallbackUrl").isJsonNull()) && !jsonObj.get("answerFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `answerFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("answerFallbackUrl").toString())); + } + if ((jsonObj.get("disconnectUrl") != null && !jsonObj.get("disconnectUrl").isJsonNull()) && !jsonObj.get("disconnectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `disconnectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("disconnectUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); + } + if ((jsonObj.get("fallbackPassword") != null && !jsonObj.get("fallbackPassword").isJsonNull()) && !jsonObj.get("fallbackPassword").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackPassword` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackPassword").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateCallResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateCallResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateCallResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateCallResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateCallResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateCallResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateCallResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateCallResponse + * @throws IOException if the JSON string is invalid with respect to CreateCallResponse + */ + public static CreateCallResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateCallResponse.class); + } + + /** + * Convert an instance of CreateCallResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java new file mode 100644 index 00000000..99e15259 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateLookupResponse.java @@ -0,0 +1,314 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.LookupStatusEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The request has been accepted for processing but not yet finished and in a terminal state (COMPLETE, PARTIAL_COMPLETE, or FAILED). + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CreateLookupResponse { + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + private String requestId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private LookupStatusEnum status; + + public CreateLookupResponse() { + } + + public CreateLookupResponse requestId(String requestId) { + + this.requestId = requestId; + return this; + } + + /** + * The phone number lookup request ID from Bandwidth. + * @return requestId + **/ + @javax.annotation.Nullable + public String getRequestId() { + return requestId; + } + + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + + public CreateLookupResponse status(LookupStatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public LookupStatusEnum getStatus() { + return status; + } + + + public void setStatus(LookupStatusEnum status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateLookupResponse instance itself + */ + public CreateLookupResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateLookupResponse createLookupResponse = (CreateLookupResponse) o; + return Objects.equals(this.requestId, createLookupResponse.requestId) && + Objects.equals(this.status, createLookupResponse.status)&& + Objects.equals(this.additionalProperties, createLookupResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(requestId, status, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateLookupResponse {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestId"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateLookupResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateLookupResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateLookupResponse is not found in the empty JSON string", CreateLookupResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) && !jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateLookupResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateLookupResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateLookupResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateLookupResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateLookupResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateLookupResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateLookupResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateLookupResponse + * @throws IOException if the JSON string is invalid with respect to CreateLookupResponse + */ + public static CreateLookupResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateLookupResponse.class); + } + + /** + * Convert an instance of CreateLookupResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java new file mode 100644 index 00000000..8299eb8b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/CreateMessageRequestError.java @@ -0,0 +1,378 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.FieldError; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * CreateMessageRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class CreateMessageRequestError { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_FIELD_ERRORS = "fieldErrors"; + @SerializedName(SERIALIZED_NAME_FIELD_ERRORS) + private List fieldErrors; + + public CreateMessageRequestError() { + } + + public CreateMessageRequestError type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public CreateMessageRequestError description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public CreateMessageRequestError fieldErrors(List fieldErrors) { + + this.fieldErrors = fieldErrors; + return this; + } + + public CreateMessageRequestError addFieldErrorsItem(FieldError fieldErrorsItem) { + if (this.fieldErrors == null) { + this.fieldErrors = new ArrayList<>(); + } + this.fieldErrors.add(fieldErrorsItem); + return this; + } + + /** + * Get fieldErrors + * @return fieldErrors + **/ + @javax.annotation.Nullable + public List getFieldErrors() { + return fieldErrors; + } + + + public void setFieldErrors(List fieldErrors) { + this.fieldErrors = fieldErrors; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateMessageRequestError instance itself + */ + public CreateMessageRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateMessageRequestError createMessageRequestError = (CreateMessageRequestError) o; + return Objects.equals(this.type, createMessageRequestError.type) && + Objects.equals(this.description, createMessageRequestError.description) && + Objects.equals(this.fieldErrors, createMessageRequestError.fieldErrors)&& + Objects.equals(this.additionalProperties, createMessageRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, fieldErrors, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateMessageRequestError {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" fieldErrors: ").append(toIndentedString(fieldErrors)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + openapiFields.add("fieldErrors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateMessageRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateMessageRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateMessageRequestError is not found in the empty JSON string", CreateMessageRequestError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateMessageRequestError.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (jsonObj.get("fieldErrors") != null && !jsonObj.get("fieldErrors").isJsonNull()) { + JsonArray jsonArrayfieldErrors = jsonObj.getAsJsonArray("fieldErrors"); + if (jsonArrayfieldErrors != null) { + // ensure the json data is an array + if (!jsonObj.get("fieldErrors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldErrors` to be an array in the JSON string but got `%s`", jsonObj.get("fieldErrors").toString())); + } + + // validate the optional field `fieldErrors` (array) + for (int i = 0; i < jsonArrayfieldErrors.size(); i++) { + FieldError.validateJsonElement(jsonArrayfieldErrors.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateMessageRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateMessageRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateMessageRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateMessageRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateMessageRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateMessageRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateMessageRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateMessageRequestError + * @throws IOException if the JSON string is invalid with respect to CreateMessageRequestError + */ + public static CreateMessageRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateMessageRequestError.class); + } + + /** + * Convert an instance of CreateMessageRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/DeferredResult.java b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java new file mode 100644 index 00000000..a69c8d9e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DeferredResult.java @@ -0,0 +1,310 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * DeferredResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class DeferredResult { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private Object result; + + public static final String SERIALIZED_NAME_SET_OR_EXPIRED = "setOrExpired"; + @SerializedName(SERIALIZED_NAME_SET_OR_EXPIRED) + private Boolean setOrExpired; + + public DeferredResult() { + } + + public DeferredResult result(Object result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nullable + public Object getResult() { + return result; + } + + + public void setResult(Object result) { + this.result = result; + } + + + public DeferredResult setOrExpired(Boolean setOrExpired) { + + this.setOrExpired = setOrExpired; + return this; + } + + /** + * Get setOrExpired + * @return setOrExpired + **/ + @javax.annotation.Nullable + public Boolean getSetOrExpired() { + return setOrExpired; + } + + + public void setSetOrExpired(Boolean setOrExpired) { + this.setOrExpired = setOrExpired; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeferredResult instance itself + */ + public DeferredResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DeferredResult deferredResult = (DeferredResult) o; + return Objects.equals(this.result, deferredResult.result) && + Objects.equals(this.setOrExpired, deferredResult.setOrExpired)&& + Objects.equals(this.additionalProperties, deferredResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(result, setOrExpired, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeferredResult {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" setOrExpired: ").append(toIndentedString(setOrExpired)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + openapiFields.add("setOrExpired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeferredResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeferredResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeferredResult is not found in the empty JSON string", DeferredResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeferredResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeferredResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeferredResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeferredResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DeferredResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeferredResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DeferredResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeferredResult + * @throws IOException if the JSON string is invalid with respect to DeferredResult + */ + public static DeferredResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeferredResult.class); + } + + /** + * Convert an instance of DeferredResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java new file mode 100644 index 00000000..fc202cf5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DisconnectCallback.java @@ -0,0 +1,777 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Disconnect event is fired when a call ends, for any reason. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class DisconnectCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_CAUSE = "cause"; + @SerializedName(SERIALIZED_NAME_CAUSE) + private String cause; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_ERROR_ID = "errorId"; + @SerializedName(SERIALIZED_NAME_ERROR_ID) + private String errorId; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public DisconnectCallback() { + } + + public DisconnectCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public DisconnectCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public DisconnectCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public DisconnectCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public DisconnectCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public DisconnectCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public DisconnectCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public DisconnectCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public DisconnectCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public DisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public DisconnectCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public DisconnectCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public DisconnectCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public DisconnectCallback cause(String cause) { + + this.cause = cause; + return this; + } + + /** + * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * @return cause + **/ + @javax.annotation.Nullable + public String getCause() { + return cause; + } + + + public void setCause(String cause) { + this.cause = cause; + } + + + public DisconnectCallback errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * Text explaining the reason that caused the call to fail in case of errors. + * @return errorMessage + **/ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + public DisconnectCallback errorId(String errorId) { + + this.errorId = errorId; + return this; + } + + /** + * Bandwidth's internal id that references the error event. + * @return errorId + **/ + @javax.annotation.Nullable + public String getErrorId() { + return errorId; + } + + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + + public DisconnectCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DisconnectCallback instance itself + */ + public DisconnectCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DisconnectCallback disconnectCallback = (DisconnectCallback) o; + return Objects.equals(this.eventType, disconnectCallback.eventType) && + Objects.equals(this.eventTime, disconnectCallback.eventTime) && + Objects.equals(this.accountId, disconnectCallback.accountId) && + Objects.equals(this.applicationId, disconnectCallback.applicationId) && + Objects.equals(this.from, disconnectCallback.from) && + Objects.equals(this.to, disconnectCallback.to) && + Objects.equals(this.callId, disconnectCallback.callId) && + Objects.equals(this.direction, disconnectCallback.direction) && + Objects.equals(this.callUrl, disconnectCallback.callUrl) && + Objects.equals(this.enqueuedTime, disconnectCallback.enqueuedTime) && + Objects.equals(this.startTime, disconnectCallback.startTime) && + Objects.equals(this.answerTime, disconnectCallback.answerTime) && + Objects.equals(this.endTime, disconnectCallback.endTime) && + Objects.equals(this.cause, disconnectCallback.cause) && + Objects.equals(this.errorMessage, disconnectCallback.errorMessage) && + Objects.equals(this.errorId, disconnectCallback.errorId) && + Objects.equals(this.tag, disconnectCallback.tag)&& + Objects.equals(this.additionalProperties, disconnectCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, callId, direction, callUrl, enqueuedTime, startTime, answerTime, endTime, cause, errorMessage, errorId, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DisconnectCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" cause: ").append(toIndentedString(cause)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorId: ").append(toIndentedString(errorId)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("callId"); + openapiFields.add("direction"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("endTime"); + openapiFields.add("cause"); + openapiFields.add("errorMessage"); + openapiFields.add("errorId"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DisconnectCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DisconnectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DisconnectCallback is not found in the empty JSON string", DisconnectCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("cause") != null && !jsonObj.get("cause").isJsonNull()) && !jsonObj.get("cause").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cause` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cause").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("errorId") != null && !jsonObj.get("errorId").isJsonNull()) && !jsonObj.get("errorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorId").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DisconnectCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DisconnectCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DisconnectCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DisconnectCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DisconnectCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DisconnectCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DisconnectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of DisconnectCallback + * @throws IOException if the JSON string is invalid with respect to DisconnectCallback + */ + public static DisconnectCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DisconnectCallback.class); + } + + /** + * Convert an instance of DisconnectCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Diversion.java b/src/main/java/com/bandwidth/sdk/model/Diversion.java new file mode 100644 index 00000000..013df046 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Diversion.java @@ -0,0 +1,471 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Diversion + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Diversion { + public static final String SERIALIZED_NAME_REASON = "reason"; + @SerializedName(SERIALIZED_NAME_REASON) + private String reason; + + public static final String SERIALIZED_NAME_PRIVACY = "privacy"; + @SerializedName(SERIALIZED_NAME_PRIVACY) + private String privacy; + + public static final String SERIALIZED_NAME_SCREEN = "screen"; + @SerializedName(SERIALIZED_NAME_SCREEN) + private String screen; + + public static final String SERIALIZED_NAME_COUNTER = "counter"; + @SerializedName(SERIALIZED_NAME_COUNTER) + private String counter; + + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + private String limit; + + public static final String SERIALIZED_NAME_UNKNOWN = "unknown"; + @SerializedName(SERIALIZED_NAME_UNKNOWN) + private String unknown; + + public static final String SERIALIZED_NAME_ORIG_TO = "origTo"; + @SerializedName(SERIALIZED_NAME_ORIG_TO) + private String origTo; + + public Diversion() { + } + + public Diversion reason(String reason) { + + this.reason = reason; + return this; + } + + /** + * The reason for the diversion. Common values: unknown, user-busy, no-answer, unavailable, unconditional, time-of-day, do-not-disturb, deflection, follow-me, out-of-service, away. + * @return reason + **/ + @javax.annotation.Nullable + public String getReason() { + return reason; + } + + + public void setReason(String reason) { + this.reason = reason; + } + + + public Diversion privacy(String privacy) { + + this.privacy = privacy; + return this; + } + + /** + * off or full + * @return privacy + **/ + @javax.annotation.Nullable + public String getPrivacy() { + return privacy; + } + + + public void setPrivacy(String privacy) { + this.privacy = privacy; + } + + + public Diversion screen(String screen) { + + this.screen = screen; + return this; + } + + /** + * No if the number was provided by the user, yes if the number was provided by the network + * @return screen + **/ + @javax.annotation.Nullable + public String getScreen() { + return screen; + } + + + public void setScreen(String screen) { + this.screen = screen; + } + + + public Diversion counter(String counter) { + + this.counter = counter; + return this; + } + + /** + * The number of diversions that have occurred + * @return counter + **/ + @javax.annotation.Nullable + public String getCounter() { + return counter; + } + + + public void setCounter(String counter) { + this.counter = counter; + } + + + public Diversion limit(String limit) { + + this.limit = limit; + return this; + } + + /** + * The maximum number of diversions allowed for this session + * @return limit + **/ + @javax.annotation.Nullable + public String getLimit() { + return limit; + } + + + public void setLimit(String limit) { + this.limit = limit; + } + + + public Diversion unknown(String unknown) { + + this.unknown = unknown; + return this; + } + + /** + * The normal list of values is not exhaustive. Your application must be tolerant of unlisted keys and unlisted values of those keys. + * @return unknown + **/ + @javax.annotation.Nullable + public String getUnknown() { + return unknown; + } + + + public void setUnknown(String unknown) { + this.unknown = unknown; + } + + + public Diversion origTo(String origTo) { + + this.origTo = origTo; + return this; + } + + /** + * Always present. Indicates the last telephone number that the call was diverted from. + * @return origTo + **/ + @javax.annotation.Nullable + public String getOrigTo() { + return origTo; + } + + + public void setOrigTo(String origTo) { + this.origTo = origTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Diversion instance itself + */ + public Diversion putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Diversion diversion = (Diversion) o; + return Objects.equals(this.reason, diversion.reason) && + Objects.equals(this.privacy, diversion.privacy) && + Objects.equals(this.screen, diversion.screen) && + Objects.equals(this.counter, diversion.counter) && + Objects.equals(this.limit, diversion.limit) && + Objects.equals(this.unknown, diversion.unknown) && + Objects.equals(this.origTo, diversion.origTo)&& + Objects.equals(this.additionalProperties, diversion.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(reason, privacy, screen, counter, limit, unknown, origTo, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Diversion {\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n"); + sb.append(" screen: ").append(toIndentedString(screen)).append("\n"); + sb.append(" counter: ").append(toIndentedString(counter)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" unknown: ").append(toIndentedString(unknown)).append("\n"); + sb.append(" origTo: ").append(toIndentedString(origTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reason"); + openapiFields.add("privacy"); + openapiFields.add("screen"); + openapiFields.add("counter"); + openapiFields.add("limit"); + openapiFields.add("unknown"); + openapiFields.add("origTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Diversion + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Diversion.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Diversion is not found in the empty JSON string", Diversion.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("reason") != null && !jsonObj.get("reason").isJsonNull()) && !jsonObj.get("reason").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `reason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reason").toString())); + } + if ((jsonObj.get("privacy") != null && !jsonObj.get("privacy").isJsonNull()) && !jsonObj.get("privacy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `privacy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("privacy").toString())); + } + if ((jsonObj.get("screen") != null && !jsonObj.get("screen").isJsonNull()) && !jsonObj.get("screen").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `screen` to be a primitive type in the JSON string but got `%s`", jsonObj.get("screen").toString())); + } + if ((jsonObj.get("counter") != null && !jsonObj.get("counter").isJsonNull()) && !jsonObj.get("counter").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `counter` to be a primitive type in the JSON string but got `%s`", jsonObj.get("counter").toString())); + } + if ((jsonObj.get("limit") != null && !jsonObj.get("limit").isJsonNull()) && !jsonObj.get("limit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `limit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("limit").toString())); + } + if ((jsonObj.get("unknown") != null && !jsonObj.get("unknown").isJsonNull()) && !jsonObj.get("unknown").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `unknown` to be a primitive type in the JSON string but got `%s`", jsonObj.get("unknown").toString())); + } + if ((jsonObj.get("origTo") != null && !jsonObj.get("origTo").isJsonNull()) && !jsonObj.get("origTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `origTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("origTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Diversion.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Diversion' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Diversion.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Diversion value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Diversion read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Diversion instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Diversion given an JSON string + * + * @param jsonString JSON string + * @return An instance of Diversion + * @throws IOException if the JSON string is invalid with respect to Diversion + */ + public static Diversion fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Diversion.class); + } + + /** + * Convert an instance of Diversion to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/DiversionReason.java b/src/main/java/com/bandwidth/sdk/model/DiversionReason.java new file mode 100644 index 00000000..8af30ae8 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DiversionReason.java @@ -0,0 +1,45 @@ +package com.bandwidth.sdk.model; + +import static java.util.function.Function.identity; +import static java.util.stream.Collectors.toMap; + +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Arrays; +import java.util.Map; +import lombok.Getter; + +@Getter +public enum DiversionReason { + AWAY("away"), + DEFLECTION("deflection"), + DO_NOT_DISTURB("do-not-disturb"), + FOLLOW_ME("follow-me"), + NO_ANSWER("no-answer"), + OUT_OF_SERVICE("out-of-service"), + TIME_OF_DAY("time-of-day"), + UNAVAILABLE("unavailable"), + UNCONDITIONAL("unconditional"), + UNKNOWN("unknown"), + USER_BUSY("user-busy"), + ; + + private static final Map DESERIALIZATION_MAP = + Arrays.stream(values()) + .collect(toMap(v -> v.name, identity())); + + private final String name; + + DiversionReason(String name) { + this.name = name; + } + + @JsonCreator + public static DiversionReason resolve(String name) { + return DESERIALIZATION_MAP.get(name.toLowerCase()); + } + + @Override + public String toString() { + return name; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/DiversionTreatment.java b/src/main/java/com/bandwidth/sdk/model/DiversionTreatment.java new file mode 100644 index 00000000..684666d1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DiversionTreatment.java @@ -0,0 +1,37 @@ +package com.bandwidth.sdk.model; + +import static java.util.function.Function.identity; +import static java.util.stream.Collectors.toMap; + +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Arrays; +import java.util.Map; +import lombok.Getter; + +@Getter +public enum DiversionTreatment { + NONE("none"), + PROPAGATE("propagate"), + STACK("stack"), + ; + + private static final Map DESERIALIZATION_MAP = + Arrays.stream(values()) + .collect(toMap(v -> v.name, identity())); + + private final String name; + + DiversionTreatment(String name) { + this.name = name; + } + + @JsonCreator + public static DiversionTreatment resolve(String name) { + return DESERIALIZATION_MAP.get(name.toLowerCase()); + } + + @Override + public String toString() { + return name; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java new file mode 100644 index 00000000..149f730a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/DtmfCallback.java @@ -0,0 +1,780 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The DTMF event is sent for every digit detected after a <StartGather> verb is executed. You may not respond to this event with BXML. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class DtmfCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_DIGIT = "digit"; + @SerializedName(SERIALIZED_NAME_DIGIT) + private String digit; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public DtmfCallback() { + } + + public DtmfCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public DtmfCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public DtmfCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public DtmfCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public DtmfCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public DtmfCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public DtmfCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public DtmfCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public DtmfCallback digit(String digit) { + + this.digit = digit; + return this; + } + + /** + * The digit collected in the call. + * @return digit + **/ + @javax.annotation.Nullable + public String getDigit() { + return digit; + } + + + public void setDigit(String digit) { + this.digit = digit; + } + + + public DtmfCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public DtmfCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public DtmfCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public DtmfCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public DtmfCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public DtmfCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public DtmfCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + + public DtmfCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DtmfCallback instance itself + */ + public DtmfCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DtmfCallback dtmfCallback = (DtmfCallback) o; + return Objects.equals(this.eventType, dtmfCallback.eventType) && + Objects.equals(this.eventTime, dtmfCallback.eventTime) && + Objects.equals(this.accountId, dtmfCallback.accountId) && + Objects.equals(this.applicationId, dtmfCallback.applicationId) && + Objects.equals(this.from, dtmfCallback.from) && + Objects.equals(this.to, dtmfCallback.to) && + Objects.equals(this.callId, dtmfCallback.callId) && + Objects.equals(this.direction, dtmfCallback.direction) && + Objects.equals(this.digit, dtmfCallback.digit) && + Objects.equals(this.callUrl, dtmfCallback.callUrl) && + Objects.equals(this.enqueuedTime, dtmfCallback.enqueuedTime) && + Objects.equals(this.startTime, dtmfCallback.startTime) && + Objects.equals(this.answerTime, dtmfCallback.answerTime) && + Objects.equals(this.parentCallId, dtmfCallback.parentCallId) && + Objects.equals(this.transferCallerId, dtmfCallback.transferCallerId) && + Objects.equals(this.transferTo, dtmfCallback.transferTo) && + Objects.equals(this.tag, dtmfCallback.tag)&& + Objects.equals(this.additionalProperties, dtmfCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, callId, direction, digit, callUrl, enqueuedTime, startTime, answerTime, parentCallId, transferCallerId, transferTo, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DtmfCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" digit: ").append(toIndentedString(digit)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("callId"); + openapiFields.add("direction"); + openapiFields.add("digit"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("parentCallId"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DtmfCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DtmfCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DtmfCallback is not found in the empty JSON string", DtmfCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("digit") != null && !jsonObj.get("digit").isJsonNull()) && !jsonObj.get("digit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digit").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DtmfCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DtmfCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DtmfCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DtmfCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DtmfCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DtmfCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DtmfCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of DtmfCallback + * @throws IOException if the JSON string is invalid with respect to DtmfCallback + */ + public static DtmfCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DtmfCallback.class); + } + + /** + * Convert an instance of DtmfCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/FieldError.java b/src/main/java/com/bandwidth/sdk/model/FieldError.java new file mode 100644 index 00000000..966e3850 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/FieldError.java @@ -0,0 +1,316 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * FieldError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class FieldError { + public static final String SERIALIZED_NAME_FIELD_NAME = "fieldName"; + @SerializedName(SERIALIZED_NAME_FIELD_NAME) + private String fieldName; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public FieldError() { + } + + public FieldError fieldName(String fieldName) { + + this.fieldName = fieldName; + return this; + } + + /** + * The name of the field that contains the error + * @return fieldName + **/ + @javax.annotation.Nullable + public String getFieldName() { + return fieldName; + } + + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + + public FieldError description(String description) { + + this.description = description; + return this; + } + + /** + * The error associated with the field + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FieldError instance itself + */ + public FieldError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FieldError fieldError = (FieldError) o; + return Objects.equals(this.fieldName, fieldError.fieldName) && + Objects.equals(this.description, fieldError.description)&& + Objects.equals(this.additionalProperties, fieldError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(fieldName, description, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FieldError {\n"); + sb.append(" fieldName: ").append(toIndentedString(fieldName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fieldName"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FieldError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FieldError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FieldError is not found in the empty JSON string", FieldError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("fieldName") != null && !jsonObj.get("fieldName").isJsonNull()) && !jsonObj.get("fieldName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fieldName").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FieldError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FieldError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FieldError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FieldError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FieldError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FieldError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of FieldError given an JSON string + * + * @param jsonString JSON string + * @return An instance of FieldError + * @throws IOException if the JSON string is invalid with respect to FieldError + */ + public static FieldError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FieldError.class); + } + + /** + * Convert an instance of FieldError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java new file mode 100644 index 00000000..43aaf62c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/FileFormatEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The format that the recording is stored in. + */ +@JsonAdapter(FileFormatEnum.Adapter.class) +public enum FileFormatEnum { + + MP3("mp3"), + + WAV("wav"); + + private String value; + + FileFormatEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static FileFormatEnum fromValue(String value) { + for (FileFormatEnum b : FileFormatEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final FileFormatEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public FileFormatEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FileFormatEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/GatherCallback.java b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java new file mode 100644 index 00000000..b1c07441 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/GatherCallback.java @@ -0,0 +1,811 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The gather event is sent after a <Gather> verb is executed. Its purpose is to report the gathered digits to the calling application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class GatherCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_DIGITS = "digits"; + @SerializedName(SERIALIZED_NAME_DIGITS) + private String digits; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_TERMINATING_DIGIT = "terminatingDigit"; + @SerializedName(SERIALIZED_NAME_TERMINATING_DIGIT) + private String terminatingDigit; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public GatherCallback() { + } + + public GatherCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public GatherCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public GatherCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public GatherCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public GatherCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public GatherCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public GatherCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public GatherCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public GatherCallback digits(String digits) { + + this.digits = digits; + return this; + } + + /** + * (optional) The digits, letters, and/or symbols entered by the user. The string is empty if a timeout occurred before any buttons were pressed. + * @return digits + **/ + @javax.annotation.Nullable + public String getDigits() { + return digits; + } + + + public void setDigits(String digits) { + this.digits = digits; + } + + + public GatherCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public GatherCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public GatherCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public GatherCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public GatherCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public GatherCallback terminatingDigit(String terminatingDigit) { + + this.terminatingDigit = terminatingDigit; + return this; + } + + /** + * (optional) The digit the user pressed to end the gather. Empty string value if no terminating digit was pressed. + * @return terminatingDigit + **/ + @javax.annotation.Nullable + public String getTerminatingDigit() { + return terminatingDigit; + } + + + public void setTerminatingDigit(String terminatingDigit) { + this.terminatingDigit = terminatingDigit; + } + + + public GatherCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public GatherCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + + public GatherCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the GatherCallback instance itself + */ + public GatherCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GatherCallback gatherCallback = (GatherCallback) o; + return Objects.equals(this.eventType, gatherCallback.eventType) && + Objects.equals(this.eventTime, gatherCallback.eventTime) && + Objects.equals(this.accountId, gatherCallback.accountId) && + Objects.equals(this.applicationId, gatherCallback.applicationId) && + Objects.equals(this.from, gatherCallback.from) && + Objects.equals(this.to, gatherCallback.to) && + Objects.equals(this.direction, gatherCallback.direction) && + Objects.equals(this.callId, gatherCallback.callId) && + Objects.equals(this.digits, gatherCallback.digits) && + Objects.equals(this.callUrl, gatherCallback.callUrl) && + Objects.equals(this.enqueuedTime, gatherCallback.enqueuedTime) && + Objects.equals(this.startTime, gatherCallback.startTime) && + Objects.equals(this.answerTime, gatherCallback.answerTime) && + Objects.equals(this.parentCallId, gatherCallback.parentCallId) && + Objects.equals(this.terminatingDigit, gatherCallback.terminatingDigit) && + Objects.equals(this.transferCallerId, gatherCallback.transferCallerId) && + Objects.equals(this.transferTo, gatherCallback.transferTo) && + Objects.equals(this.tag, gatherCallback.tag)&& + Objects.equals(this.additionalProperties, gatherCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, digits, callUrl, enqueuedTime, startTime, answerTime, parentCallId, terminatingDigit, transferCallerId, transferTo, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GatherCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" digits: ").append(toIndentedString(digits)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" terminatingDigit: ").append(toIndentedString(terminatingDigit)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("digits"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("parentCallId"); + openapiFields.add("terminatingDigit"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GatherCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GatherCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GatherCallback is not found in the empty JSON string", GatherCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("digits") != null && !jsonObj.get("digits").isJsonNull()) && !jsonObj.get("digits").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `digits` to be a primitive type in the JSON string but got `%s`", jsonObj.get("digits").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("terminatingDigit") != null && !jsonObj.get("terminatingDigit").isJsonNull()) && !jsonObj.get("terminatingDigit").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `terminatingDigit` to be a primitive type in the JSON string but got `%s`", jsonObj.get("terminatingDigit").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!GatherCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GatherCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GatherCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GatherCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public GatherCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + GatherCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of GatherCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of GatherCallback + * @throws IOException if the JSON string is invalid with respect to GatherCallback + */ + public static GatherCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GatherCallback.class); + } + + /** + * Convert an instance of GatherCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java new file mode 100644 index 00000000..6893b124 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.InboundMessageCallbackMessage; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Inbound Message Callback + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class InboundMessageCallback { + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private InboundMessageCallbackMessage message; + + public InboundMessageCallback() { + } + + public InboundMessageCallback time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public InboundMessageCallback type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public InboundMessageCallback to(String to) { + + this.to = to; + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public InboundMessageCallback description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public InboundMessageCallback message(InboundMessageCallbackMessage message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nonnull + public InboundMessageCallbackMessage getMessage() { + return message; + } + + + public void setMessage(InboundMessageCallbackMessage message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InboundMessageCallback instance itself + */ + public InboundMessageCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InboundMessageCallback inboundMessageCallback = (InboundMessageCallback) o; + return Objects.equals(this.time, inboundMessageCallback.time) && + Objects.equals(this.type, inboundMessageCallback.type) && + Objects.equals(this.to, inboundMessageCallback.to) && + Objects.equals(this.description, inboundMessageCallback.description) && + Objects.equals(this.message, inboundMessageCallback.message)&& + Objects.equals(this.additionalProperties, inboundMessageCallback.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(time, type, to, description, message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InboundMessageCallback {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("type"); + openapiFields.add("to"); + openapiFields.add("description"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InboundMessageCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InboundMessageCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InboundMessageCallback is not found in the empty JSON string", InboundMessageCallback.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InboundMessageCallback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `message` + InboundMessageCallbackMessage.validateJsonElement(jsonObj.get("message")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InboundMessageCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InboundMessageCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InboundMessageCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InboundMessageCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InboundMessageCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InboundMessageCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InboundMessageCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of InboundMessageCallback + * @throws IOException if the JSON string is invalid with respect to InboundMessageCallback + */ + public static InboundMessageCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InboundMessageCallback.class); + } + + /** + * Convert an instance of InboundMessageCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java new file mode 100644 index 00000000..a9b91fb5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/InboundMessageCallbackMessage.java @@ -0,0 +1,658 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Inbound Message Callback Message Schema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class InboundMessageCallbackMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private List media; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public InboundMessageCallbackMessage() { + } + + public InboundMessageCallbackMessage id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public InboundMessageCallbackMessage owner(String owner) { + + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + **/ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + + public void setOwner(String owner) { + this.owner = owner; + } + + + public InboundMessageCallbackMessage applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public InboundMessageCallbackMessage time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public InboundMessageCallbackMessage segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * Get segmentCount + * @return segmentCount + **/ + @javax.annotation.Nonnull + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public InboundMessageCallbackMessage direction(MessageDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(MessageDirectionEnum direction) { + this.direction = direction; + } + + + public InboundMessageCallbackMessage to(Set to) { + + this.to = to; + return this; + } + + public InboundMessageCallbackMessage addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public InboundMessageCallbackMessage from(String from) { + + this.from = from; + return this; + } + + /** + * Get from + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public InboundMessageCallbackMessage text(String text) { + + this.text = text; + return this; + } + + /** + * Get text + * @return text + **/ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public InboundMessageCallbackMessage tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public InboundMessageCallbackMessage media(List media) { + + this.media = media; + return this; + } + + public InboundMessageCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Get media + * @return media + **/ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + + public void setMedia(List media) { + this.media = media; + } + + + public InboundMessageCallbackMessage priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nullable + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InboundMessageCallbackMessage instance itself + */ + public InboundMessageCallbackMessage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InboundMessageCallbackMessage inboundMessageCallbackMessage = (InboundMessageCallbackMessage) o; + return Objects.equals(this.id, inboundMessageCallbackMessage.id) && + Objects.equals(this.owner, inboundMessageCallbackMessage.owner) && + Objects.equals(this.applicationId, inboundMessageCallbackMessage.applicationId) && + Objects.equals(this.time, inboundMessageCallbackMessage.time) && + Objects.equals(this.segmentCount, inboundMessageCallbackMessage.segmentCount) && + Objects.equals(this.direction, inboundMessageCallbackMessage.direction) && + Objects.equals(this.to, inboundMessageCallbackMessage.to) && + Objects.equals(this.from, inboundMessageCallbackMessage.from) && + Objects.equals(this.text, inboundMessageCallbackMessage.text) && + Objects.equals(this.tag, inboundMessageCallbackMessage.tag) && + Objects.equals(this.media, inboundMessageCallbackMessage.media) && + Objects.equals(this.priority, inboundMessageCallbackMessage.priority)&& + Objects.equals(this.additionalProperties, inboundMessageCallbackMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InboundMessageCallbackMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("media"); + openapiFields.add("priority"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("segmentCount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InboundMessageCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InboundMessageCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InboundMessageCallbackMessage is not found in the empty JSON string", InboundMessageCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InboundMessageCallbackMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InboundMessageCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InboundMessageCallbackMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InboundMessageCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InboundMessageCallbackMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InboundMessageCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InboundMessageCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InboundMessageCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of InboundMessageCallbackMessage + * @throws IOException if the JSON string is invalid with respect to InboundMessageCallbackMessage + */ + public static InboundMessageCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InboundMessageCallbackMessage.class); + } + + /** + * Convert an instance of InboundMessageCallbackMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java new file mode 100644 index 00000000..8c0b5f6b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/InitiateCallback.java @@ -0,0 +1,623 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.Diversion; +import com.bandwidth.sdk.model.StirShaken; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Initiate event is fired when an inbound call is received for a Telephone Number on your Account. It is sent to the URL specified in the application associated with the location (sip-peer) that the called telephone number belongs to. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class InitiateCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_DIVERSION = "diversion"; + @SerializedName(SERIALIZED_NAME_DIVERSION) + private Diversion diversion; + + public static final String SERIALIZED_NAME_STIR_SHAKEN = "stirShaken"; + @SerializedName(SERIALIZED_NAME_STIR_SHAKEN) + private StirShaken stirShaken; + + public InitiateCallback() { + } + + public InitiateCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public InitiateCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public InitiateCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public InitiateCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public InitiateCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public InitiateCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public InitiateCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public InitiateCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public InitiateCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public InitiateCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public InitiateCallback diversion(Diversion diversion) { + + this.diversion = diversion; + return this; + } + + /** + * Get diversion + * @return diversion + **/ + @javax.annotation.Nullable + public Diversion getDiversion() { + return diversion; + } + + + public void setDiversion(Diversion diversion) { + this.diversion = diversion; + } + + + public InitiateCallback stirShaken(StirShaken stirShaken) { + + this.stirShaken = stirShaken; + return this; + } + + /** + * Get stirShaken + * @return stirShaken + **/ + @javax.annotation.Nullable + public StirShaken getStirShaken() { + return stirShaken; + } + + + public void setStirShaken(StirShaken stirShaken) { + this.stirShaken = stirShaken; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InitiateCallback instance itself + */ + public InitiateCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + InitiateCallback initiateCallback = (InitiateCallback) o; + return Objects.equals(this.eventType, initiateCallback.eventType) && + Objects.equals(this.eventTime, initiateCallback.eventTime) && + Objects.equals(this.accountId, initiateCallback.accountId) && + Objects.equals(this.applicationId, initiateCallback.applicationId) && + Objects.equals(this.from, initiateCallback.from) && + Objects.equals(this.to, initiateCallback.to) && + Objects.equals(this.direction, initiateCallback.direction) && + Objects.equals(this.callId, initiateCallback.callId) && + Objects.equals(this.callUrl, initiateCallback.callUrl) && + Objects.equals(this.startTime, initiateCallback.startTime) && + Objects.equals(this.diversion, initiateCallback.diversion) && + Objects.equals(this.stirShaken, initiateCallback.stirShaken)&& + Objects.equals(this.additionalProperties, initiateCallback.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, startTime, diversion, stirShaken, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitiateCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" diversion: ").append(toIndentedString(diversion)).append("\n"); + sb.append(" stirShaken: ").append(toIndentedString(stirShaken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("startTime"); + openapiFields.add("diversion"); + openapiFields.add("stirShaken"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitiateCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitiateCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitiateCallback is not found in the empty JSON string", InitiateCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + // validate the optional field `diversion` + if (jsonObj.get("diversion") != null && !jsonObj.get("diversion").isJsonNull()) { + Diversion.validateJsonElement(jsonObj.get("diversion")); + } + // validate the optional field `stirShaken` + if (jsonObj.get("stirShaken") != null && !jsonObj.get("stirShaken").isJsonNull()) { + StirShaken.validateJsonElement(jsonObj.get("stirShaken")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitiateCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitiateCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitiateCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitiateCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InitiateCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InitiateCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of InitiateCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitiateCallback + * @throws IOException if the JSON string is invalid with respect to InitiateCallback + */ + public static InitiateCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitiateCallback.class); + } + + /** + * Convert an instance of InitiateCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java new file mode 100644 index 00000000..600543bf --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageDirectionEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The direction of the message. One of INBOUND OUTBOUND. + */ +@JsonAdapter(ListMessageDirectionEnum.Adapter.class) +public enum ListMessageDirectionEnum { + + INBOUND("INBOUND"), + + OUTBOUND("OUTBOUND"); + + private String value; + + ListMessageDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ListMessageDirectionEnum fromValue(String value) { + for (ListMessageDirectionEnum b : ListMessageDirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ListMessageDirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public ListMessageDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ListMessageDirectionEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java new file mode 100644 index 00000000..fd2aeabb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/ListMessageItem.java @@ -0,0 +1,767 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.ListMessageDirectionEnum; +import com.bandwidth.sdk.model.MessageStatusEnum; +import com.bandwidth.sdk.model.MessageTypeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * ListMessageItem + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class ListMessageItem { + public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; + @SerializedName(SERIALIZED_NAME_MESSAGE_ID) + private String messageId; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_SOURCE_TN = "sourceTn"; + @SerializedName(SERIALIZED_NAME_SOURCE_TN) + private String sourceTn; + + public static final String SERIALIZED_NAME_DESTINATION_TN = "destinationTn"; + @SerializedName(SERIALIZED_NAME_DESTINATION_TN) + private String destinationTn; + + public static final String SERIALIZED_NAME_MESSAGE_STATUS = "messageStatus"; + @SerializedName(SERIALIZED_NAME_MESSAGE_STATUS) + private MessageStatusEnum messageStatus; + + public static final String SERIALIZED_NAME_MESSAGE_DIRECTION = "messageDirection"; + @SerializedName(SERIALIZED_NAME_MESSAGE_DIRECTION) + private ListMessageDirectionEnum messageDirection; + + public static final String SERIALIZED_NAME_MESSAGE_TYPE = "messageType"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TYPE) + private MessageTypeEnum messageType; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private Integer errorCode; + + public static final String SERIALIZED_NAME_RECEIVE_TIME = "receiveTime"; + @SerializedName(SERIALIZED_NAME_RECEIVE_TIME) + private OffsetDateTime receiveTime; + + public static final String SERIALIZED_NAME_CARRIER_NAME = "carrierName"; + @SerializedName(SERIALIZED_NAME_CARRIER_NAME) + private String carrierName; + + public static final String SERIALIZED_NAME_MESSAGE_SIZE = "messageSize"; + @SerializedName(SERIALIZED_NAME_MESSAGE_SIZE) + private Integer messageSize; + + public static final String SERIALIZED_NAME_MESSAGE_LENGTH = "messageLength"; + @SerializedName(SERIALIZED_NAME_MESSAGE_LENGTH) + private Integer messageLength; + + public static final String SERIALIZED_NAME_ATTACHMENT_COUNT = "attachmentCount"; + @SerializedName(SERIALIZED_NAME_ATTACHMENT_COUNT) + private Integer attachmentCount; + + public static final String SERIALIZED_NAME_RECIPIENT_COUNT = "recipientCount"; + @SerializedName(SERIALIZED_NAME_RECIPIENT_COUNT) + private Integer recipientCount; + + public static final String SERIALIZED_NAME_CAMPAIGN_CLASS = "campaignClass"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN_CLASS) + private String campaignClass; + + public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId"; + @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID) + private String campaignId; + + public ListMessageItem() { + } + + public ListMessageItem messageId(String messageId) { + + this.messageId = messageId; + return this; + } + + /** + * The message id + * @return messageId + **/ + @javax.annotation.Nullable + public String getMessageId() { + return messageId; + } + + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + + public ListMessageItem accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The account id associated with this message. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public ListMessageItem sourceTn(String sourceTn) { + + this.sourceTn = sourceTn; + return this; + } + + /** + * The source phone number of the message. + * @return sourceTn + **/ + @javax.annotation.Nullable + public String getSourceTn() { + return sourceTn; + } + + + public void setSourceTn(String sourceTn) { + this.sourceTn = sourceTn; + } + + + public ListMessageItem destinationTn(String destinationTn) { + + this.destinationTn = destinationTn; + return this; + } + + /** + * The recipient phone number of the message. + * @return destinationTn + **/ + @javax.annotation.Nullable + public String getDestinationTn() { + return destinationTn; + } + + + public void setDestinationTn(String destinationTn) { + this.destinationTn = destinationTn; + } + + + public ListMessageItem messageStatus(MessageStatusEnum messageStatus) { + + this.messageStatus = messageStatus; + return this; + } + + /** + * Get messageStatus + * @return messageStatus + **/ + @javax.annotation.Nullable + public MessageStatusEnum getMessageStatus() { + return messageStatus; + } + + + public void setMessageStatus(MessageStatusEnum messageStatus) { + this.messageStatus = messageStatus; + } + + + public ListMessageItem messageDirection(ListMessageDirectionEnum messageDirection) { + + this.messageDirection = messageDirection; + return this; + } + + /** + * Get messageDirection + * @return messageDirection + **/ + @javax.annotation.Nullable + public ListMessageDirectionEnum getMessageDirection() { + return messageDirection; + } + + + public void setMessageDirection(ListMessageDirectionEnum messageDirection) { + this.messageDirection = messageDirection; + } + + + public ListMessageItem messageType(MessageTypeEnum messageType) { + + this.messageType = messageType; + return this; + } + + /** + * Get messageType + * @return messageType + **/ + @javax.annotation.Nullable + public MessageTypeEnum getMessageType() { + return messageType; + } + + + public void setMessageType(MessageTypeEnum messageType) { + this.messageType = messageType; + } + + + public ListMessageItem segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * The number of segments the message was sent as. + * @return segmentCount + **/ + @javax.annotation.Nullable + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public ListMessageItem errorCode(Integer errorCode) { + + this.errorCode = errorCode; + return this; + } + + /** + * The numeric error code of the message. + * @return errorCode + **/ + @javax.annotation.Nullable + public Integer getErrorCode() { + return errorCode; + } + + + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + + public ListMessageItem receiveTime(OffsetDateTime receiveTime) { + + this.receiveTime = receiveTime; + return this; + } + + /** + * The ISO 8601 datetime of the message. + * @return receiveTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getReceiveTime() { + return receiveTime; + } + + + public void setReceiveTime(OffsetDateTime receiveTime) { + this.receiveTime = receiveTime; + } + + + public ListMessageItem carrierName(String carrierName) { + + this.carrierName = carrierName; + return this; + } + + /** + * The name of the carrier. Not currently supported for MMS coming soon. + * @return carrierName + **/ + @javax.annotation.Nullable + public String getCarrierName() { + return carrierName; + } + + + public void setCarrierName(String carrierName) { + this.carrierName = carrierName; + } + + + public ListMessageItem messageSize(Integer messageSize) { + + this.messageSize = messageSize; + return this; + } + + /** + * The size of the message including message content and headers. + * @return messageSize + **/ + @javax.annotation.Nullable + public Integer getMessageSize() { + return messageSize; + } + + + public void setMessageSize(Integer messageSize) { + this.messageSize = messageSize; + } + + + public ListMessageItem messageLength(Integer messageLength) { + + this.messageLength = messageLength; + return this; + } + + /** + * The length of the message content. + * @return messageLength + **/ + @javax.annotation.Nullable + public Integer getMessageLength() { + return messageLength; + } + + + public void setMessageLength(Integer messageLength) { + this.messageLength = messageLength; + } + + + public ListMessageItem attachmentCount(Integer attachmentCount) { + + this.attachmentCount = attachmentCount; + return this; + } + + /** + * The number of attachments the message has. + * @return attachmentCount + **/ + @javax.annotation.Nullable + public Integer getAttachmentCount() { + return attachmentCount; + } + + + public void setAttachmentCount(Integer attachmentCount) { + this.attachmentCount = attachmentCount; + } + + + public ListMessageItem recipientCount(Integer recipientCount) { + + this.recipientCount = recipientCount; + return this; + } + + /** + * The number of recipients the message has. + * @return recipientCount + **/ + @javax.annotation.Nullable + public Integer getRecipientCount() { + return recipientCount; + } + + + public void setRecipientCount(Integer recipientCount) { + this.recipientCount = recipientCount; + } + + + public ListMessageItem campaignClass(String campaignClass) { + + this.campaignClass = campaignClass; + return this; + } + + /** + * The campaign class of the message if it has one. + * @return campaignClass + **/ + @javax.annotation.Nullable + public String getCampaignClass() { + return campaignClass; + } + + + public void setCampaignClass(String campaignClass) { + this.campaignClass = campaignClass; + } + + + public ListMessageItem campaignId(String campaignId) { + + this.campaignId = campaignId; + return this; + } + + /** + * The campaign ID of the message if it has one. + * @return campaignId + **/ + @javax.annotation.Nullable + public String getCampaignId() { + return campaignId; + } + + + public void setCampaignId(String campaignId) { + this.campaignId = campaignId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ListMessageItem instance itself + */ + public ListMessageItem putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListMessageItem listMessageItem = (ListMessageItem) o; + return Objects.equals(this.messageId, listMessageItem.messageId) && + Objects.equals(this.accountId, listMessageItem.accountId) && + Objects.equals(this.sourceTn, listMessageItem.sourceTn) && + Objects.equals(this.destinationTn, listMessageItem.destinationTn) && + Objects.equals(this.messageStatus, listMessageItem.messageStatus) && + Objects.equals(this.messageDirection, listMessageItem.messageDirection) && + Objects.equals(this.messageType, listMessageItem.messageType) && + Objects.equals(this.segmentCount, listMessageItem.segmentCount) && + Objects.equals(this.errorCode, listMessageItem.errorCode) && + Objects.equals(this.receiveTime, listMessageItem.receiveTime) && + Objects.equals(this.carrierName, listMessageItem.carrierName) && + Objects.equals(this.messageSize, listMessageItem.messageSize) && + Objects.equals(this.messageLength, listMessageItem.messageLength) && + Objects.equals(this.attachmentCount, listMessageItem.attachmentCount) && + Objects.equals(this.recipientCount, listMessageItem.recipientCount) && + Objects.equals(this.campaignClass, listMessageItem.campaignClass) && + Objects.equals(this.campaignId, listMessageItem.campaignId)&& + Objects.equals(this.additionalProperties, listMessageItem.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(messageId, accountId, sourceTn, destinationTn, messageStatus, messageDirection, messageType, segmentCount, errorCode, receiveTime, carrierName, messageSize, messageLength, attachmentCount, recipientCount, campaignClass, campaignId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListMessageItem {\n"); + sb.append(" messageId: ").append(toIndentedString(messageId)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" sourceTn: ").append(toIndentedString(sourceTn)).append("\n"); + sb.append(" destinationTn: ").append(toIndentedString(destinationTn)).append("\n"); + sb.append(" messageStatus: ").append(toIndentedString(messageStatus)).append("\n"); + sb.append(" messageDirection: ").append(toIndentedString(messageDirection)).append("\n"); + sb.append(" messageType: ").append(toIndentedString(messageType)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" receiveTime: ").append(toIndentedString(receiveTime)).append("\n"); + sb.append(" carrierName: ").append(toIndentedString(carrierName)).append("\n"); + sb.append(" messageSize: ").append(toIndentedString(messageSize)).append("\n"); + sb.append(" messageLength: ").append(toIndentedString(messageLength)).append("\n"); + sb.append(" attachmentCount: ").append(toIndentedString(attachmentCount)).append("\n"); + sb.append(" recipientCount: ").append(toIndentedString(recipientCount)).append("\n"); + sb.append(" campaignClass: ").append(toIndentedString(campaignClass)).append("\n"); + sb.append(" campaignId: ").append(toIndentedString(campaignId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("messageId"); + openapiFields.add("accountId"); + openapiFields.add("sourceTn"); + openapiFields.add("destinationTn"); + openapiFields.add("messageStatus"); + openapiFields.add("messageDirection"); + openapiFields.add("messageType"); + openapiFields.add("segmentCount"); + openapiFields.add("errorCode"); + openapiFields.add("receiveTime"); + openapiFields.add("carrierName"); + openapiFields.add("messageSize"); + openapiFields.add("messageLength"); + openapiFields.add("attachmentCount"); + openapiFields.add("recipientCount"); + openapiFields.add("campaignClass"); + openapiFields.add("campaignId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ListMessageItem + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ListMessageItem.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ListMessageItem is not found in the empty JSON string", ListMessageItem.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("messageId") != null && !jsonObj.get("messageId").isJsonNull()) && !jsonObj.get("messageId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `messageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageId").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("sourceTn") != null && !jsonObj.get("sourceTn").isJsonNull()) && !jsonObj.get("sourceTn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceTn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceTn").toString())); + } + if ((jsonObj.get("destinationTn") != null && !jsonObj.get("destinationTn").isJsonNull()) && !jsonObj.get("destinationTn").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `destinationTn` to be a primitive type in the JSON string but got `%s`", jsonObj.get("destinationTn").toString())); + } + if ((jsonObj.get("carrierName") != null && !jsonObj.get("carrierName").isJsonNull()) && !jsonObj.get("carrierName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `carrierName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("carrierName").toString())); + } + if ((jsonObj.get("campaignClass") != null && !jsonObj.get("campaignClass").isJsonNull()) && !jsonObj.get("campaignClass").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `campaignClass` to be a primitive type in the JSON string but got `%s`", jsonObj.get("campaignClass").toString())); + } + if ((jsonObj.get("campaignId") != null && !jsonObj.get("campaignId").isJsonNull()) && !jsonObj.get("campaignId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `campaignId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("campaignId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ListMessageItem.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ListMessageItem' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ListMessageItem.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ListMessageItem value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ListMessageItem read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ListMessageItem instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ListMessageItem given an JSON string + * + * @param jsonString JSON string + * @return An instance of ListMessageItem + * @throws IOException if the JSON string is invalid with respect to ListMessageItem + */ + public static ListMessageItem fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ListMessageItem.class); + } + + /** + * Convert an instance of ListMessageItem to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LookupRequest.java b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java new file mode 100644 index 00000000..73979c21 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LookupRequest.java @@ -0,0 +1,306 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Create phone number lookup request. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class LookupRequest { + public static final String SERIALIZED_NAME_TNS = "tns"; + @SerializedName(SERIALIZED_NAME_TNS) + private List tns = new ArrayList<>(); + + public LookupRequest() { + } + + public LookupRequest tns(List tns) { + + this.tns = tns; + return this; + } + + public LookupRequest addTnsItem(String tnsItem) { + if (this.tns == null) { + this.tns = new ArrayList<>(); + } + this.tns.add(tnsItem); + return this; + } + + /** + * Get tns + * @return tns + **/ + @javax.annotation.Nonnull + public List getTns() { + return tns; + } + + + public void setTns(List tns) { + this.tns = tns; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LookupRequest instance itself + */ + public LookupRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LookupRequest lookupRequest = (LookupRequest) o; + return Objects.equals(this.tns, lookupRequest.tns)&& + Objects.equals(this.additionalProperties, lookupRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(tns, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LookupRequest {\n"); + sb.append(" tns: ").append(toIndentedString(tns)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("tns"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tns"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LookupRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LookupRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LookupRequest is not found in the empty JSON string", LookupRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LookupRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("tns") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("tns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tns` to be an array in the JSON string but got `%s`", jsonObj.get("tns").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LookupRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LookupRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LookupRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LookupRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LookupRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LookupRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LookupRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupRequest + * @throws IOException if the JSON string is invalid with respect to LookupRequest + */ + public static LookupRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LookupRequest.class); + } + + /** + * Convert an instance of LookupRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LookupResult.java b/src/main/java/com/bandwidth/sdk/model/LookupResult.java new file mode 100644 index 00000000..7e3ac976 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LookupResult.java @@ -0,0 +1,530 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Carrier information results for the specified telephone number. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class LookupResult { + public static final String SERIALIZED_NAME_RESPONSE_CODE = "Response Code"; + @SerializedName(SERIALIZED_NAME_RESPONSE_CODE) + private Integer responseCode; + + public static final String SERIALIZED_NAME_MESSAGE = "Message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public static final String SERIALIZED_NAME_E164_FORMAT = "E.164 Format"; + @SerializedName(SERIALIZED_NAME_E164_FORMAT) + private String e164Format; + + public static final String SERIALIZED_NAME_FORMATTED = "Formatted"; + @SerializedName(SERIALIZED_NAME_FORMATTED) + private String formatted; + + public static final String SERIALIZED_NAME_COUNTRY = "Country"; + @SerializedName(SERIALIZED_NAME_COUNTRY) + private String country; + + public static final String SERIALIZED_NAME_LINE_TYPE = "Line Type"; + @SerializedName(SERIALIZED_NAME_LINE_TYPE) + private String lineType; + + public static final String SERIALIZED_NAME_LINE_PROVIDER = "Line Provider"; + @SerializedName(SERIALIZED_NAME_LINE_PROVIDER) + private String lineProvider; + + public static final String SERIALIZED_NAME_MOBILE_COUNTRY_CODE = "Mobile Country Code"; + @SerializedName(SERIALIZED_NAME_MOBILE_COUNTRY_CODE) + private String mobileCountryCode; + + public static final String SERIALIZED_NAME_MOBILE_NETWORK_CODE = "Mobile Network Code"; + @SerializedName(SERIALIZED_NAME_MOBILE_NETWORK_CODE) + private String mobileNetworkCode; + + public LookupResult() { + } + + public LookupResult responseCode(Integer responseCode) { + + this.responseCode = responseCode; + return this; + } + + /** + * Our vendor's response code. + * @return responseCode + **/ + @javax.annotation.Nullable + public Integer getResponseCode() { + return responseCode; + } + + + public void setResponseCode(Integer responseCode) { + this.responseCode = responseCode; + } + + + public LookupResult message(String message) { + + this.message = message; + return this; + } + + /** + * Message associated with the response code. + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + + public LookupResult e164Format(String e164Format) { + + this.e164Format = e164Format; + return this; + } + + /** + * The telephone number in E.164 format. + * @return e164Format + **/ + @javax.annotation.Nullable + public String getE164Format() { + return e164Format; + } + + + public void setE164Format(String e164Format) { + this.e164Format = e164Format; + } + + + public LookupResult formatted(String formatted) { + + this.formatted = formatted; + return this; + } + + /** + * The formatted version of the telephone number. + * @return formatted + **/ + @javax.annotation.Nullable + public String getFormatted() { + return formatted; + } + + + public void setFormatted(String formatted) { + this.formatted = formatted; + } + + + public LookupResult country(String country) { + + this.country = country; + return this; + } + + /** + * The country of the telephone number. + * @return country + **/ + @javax.annotation.Nullable + public String getCountry() { + return country; + } + + + public void setCountry(String country) { + this.country = country; + } + + + public LookupResult lineType(String lineType) { + + this.lineType = lineType; + return this; + } + + /** + * The line type of the telephone number. + * @return lineType + **/ + @javax.annotation.Nullable + public String getLineType() { + return lineType; + } + + + public void setLineType(String lineType) { + this.lineType = lineType; + } + + + public LookupResult lineProvider(String lineProvider) { + + this.lineProvider = lineProvider; + return this; + } + + /** + * The messaging service provider of the telephone number. + * @return lineProvider + **/ + @javax.annotation.Nullable + public String getLineProvider() { + return lineProvider; + } + + + public void setLineProvider(String lineProvider) { + this.lineProvider = lineProvider; + } + + + public LookupResult mobileCountryCode(String mobileCountryCode) { + + this.mobileCountryCode = mobileCountryCode; + return this; + } + + /** + * The first half of the Home Network Identity (HNI). + * @return mobileCountryCode + **/ + @javax.annotation.Nullable + public String getMobileCountryCode() { + return mobileCountryCode; + } + + + public void setMobileCountryCode(String mobileCountryCode) { + this.mobileCountryCode = mobileCountryCode; + } + + + public LookupResult mobileNetworkCode(String mobileNetworkCode) { + + this.mobileNetworkCode = mobileNetworkCode; + return this; + } + + /** + * The second half of the HNI. + * @return mobileNetworkCode + **/ + @javax.annotation.Nullable + public String getMobileNetworkCode() { + return mobileNetworkCode; + } + + + public void setMobileNetworkCode(String mobileNetworkCode) { + this.mobileNetworkCode = mobileNetworkCode; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LookupResult instance itself + */ + public LookupResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LookupResult lookupResult = (LookupResult) o; + return Objects.equals(this.responseCode, lookupResult.responseCode) && + Objects.equals(this.message, lookupResult.message) && + Objects.equals(this.e164Format, lookupResult.e164Format) && + Objects.equals(this.formatted, lookupResult.formatted) && + Objects.equals(this.country, lookupResult.country) && + Objects.equals(this.lineType, lookupResult.lineType) && + Objects.equals(this.lineProvider, lookupResult.lineProvider) && + Objects.equals(this.mobileCountryCode, lookupResult.mobileCountryCode) && + Objects.equals(this.mobileNetworkCode, lookupResult.mobileNetworkCode)&& + Objects.equals(this.additionalProperties, lookupResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(responseCode, message, e164Format, formatted, country, lineType, lineProvider, mobileCountryCode, mobileNetworkCode, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LookupResult {\n"); + sb.append(" responseCode: ").append(toIndentedString(responseCode)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" e164Format: ").append(toIndentedString(e164Format)).append("\n"); + sb.append(" formatted: ").append(toIndentedString(formatted)).append("\n"); + sb.append(" country: ").append(toIndentedString(country)).append("\n"); + sb.append(" lineType: ").append(toIndentedString(lineType)).append("\n"); + sb.append(" lineProvider: ").append(toIndentedString(lineProvider)).append("\n"); + sb.append(" mobileCountryCode: ").append(toIndentedString(mobileCountryCode)).append("\n"); + sb.append(" mobileNetworkCode: ").append(toIndentedString(mobileNetworkCode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("Response Code"); + openapiFields.add("Message"); + openapiFields.add("E.164 Format"); + openapiFields.add("Formatted"); + openapiFields.add("Country"); + openapiFields.add("Line Type"); + openapiFields.add("Line Provider"); + openapiFields.add("Mobile Country Code"); + openapiFields.add("Mobile Network Code"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LookupResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LookupResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LookupResult is not found in the empty JSON string", LookupResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("Message") != null && !jsonObj.get("Message").isJsonNull()) && !jsonObj.get("Message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Message").toString())); + } + if ((jsonObj.get("E.164 Format") != null && !jsonObj.get("E.164 Format").isJsonNull()) && !jsonObj.get("E.164 Format").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `E.164 Format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("E.164 Format").toString())); + } + if ((jsonObj.get("Formatted") != null && !jsonObj.get("Formatted").isJsonNull()) && !jsonObj.get("Formatted").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Formatted` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Formatted").toString())); + } + if ((jsonObj.get("Country") != null && !jsonObj.get("Country").isJsonNull()) && !jsonObj.get("Country").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Country` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Country").toString())); + } + if ((jsonObj.get("Line Type") != null && !jsonObj.get("Line Type").isJsonNull()) && !jsonObj.get("Line Type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Line Type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Line Type").toString())); + } + if ((jsonObj.get("Line Provider") != null && !jsonObj.get("Line Provider").isJsonNull()) && !jsonObj.get("Line Provider").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Line Provider` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Line Provider").toString())); + } + if ((jsonObj.get("Mobile Country Code") != null && !jsonObj.get("Mobile Country Code").isJsonNull()) && !jsonObj.get("Mobile Country Code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Mobile Country Code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Mobile Country Code").toString())); + } + if ((jsonObj.get("Mobile Network Code") != null && !jsonObj.get("Mobile Network Code").isJsonNull()) && !jsonObj.get("Mobile Network Code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `Mobile Network Code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("Mobile Network Code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LookupResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LookupResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LookupResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LookupResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LookupResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LookupResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LookupResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupResult + * @throws IOException if the JSON string is invalid with respect to LookupResult + */ + public static LookupResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LookupResult.class); + } + + /** + * Convert an instance of LookupResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatus.java b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java new file mode 100644 index 00000000..d019f3e3 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatus.java @@ -0,0 +1,407 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.LookupResult; +import com.bandwidth.sdk.model.LookupStatusEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * If requestId exists, the result for that request is returned. See the Examples for details on the various responses that you can receive. Generally, if you see a Response Code of 0 in a result for a TN, information will be available for it. Any other Response Code will indicate no information was available for the TN. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class LookupStatus { + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + private String requestId; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private LookupStatusEnum status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private List result; + + public static final String SERIALIZED_NAME_FAILED_TELEPHONE_NUMBERS = "failedTelephoneNumbers"; + @SerializedName(SERIALIZED_NAME_FAILED_TELEPHONE_NUMBERS) + private List failedTelephoneNumbers; + + public LookupStatus() { + } + + public LookupStatus requestId(String requestId) { + + this.requestId = requestId; + return this; + } + + /** + * The requestId. + * @return requestId + **/ + @javax.annotation.Nullable + public String getRequestId() { + return requestId; + } + + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + + public LookupStatus status(LookupStatusEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public LookupStatusEnum getStatus() { + return status; + } + + + public void setStatus(LookupStatusEnum status) { + this.status = status; + } + + + public LookupStatus result(List result) { + + this.result = result; + return this; + } + + public LookupStatus addResultItem(LookupResult resultItem) { + if (this.result == null) { + this.result = new ArrayList<>(); + } + this.result.add(resultItem); + return this; + } + + /** + * The carrier information results for the specified telephone number. + * @return result + **/ + @javax.annotation.Nullable + public List getResult() { + return result; + } + + + public void setResult(List result) { + this.result = result; + } + + + public LookupStatus failedTelephoneNumbers(List failedTelephoneNumbers) { + + this.failedTelephoneNumbers = failedTelephoneNumbers; + return this; + } + + public LookupStatus addFailedTelephoneNumbersItem(String failedTelephoneNumbersItem) { + if (this.failedTelephoneNumbers == null) { + this.failedTelephoneNumbers = new ArrayList<>(); + } + this.failedTelephoneNumbers.add(failedTelephoneNumbersItem); + return this; + } + + /** + * The telephone numbers whose lookup failed. + * @return failedTelephoneNumbers + **/ + @javax.annotation.Nullable + public List getFailedTelephoneNumbers() { + return failedTelephoneNumbers; + } + + + public void setFailedTelephoneNumbers(List failedTelephoneNumbers) { + this.failedTelephoneNumbers = failedTelephoneNumbers; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the LookupStatus instance itself + */ + public LookupStatus putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LookupStatus lookupStatus = (LookupStatus) o; + return Objects.equals(this.requestId, lookupStatus.requestId) && + Objects.equals(this.status, lookupStatus.status) && + Objects.equals(this.result, lookupStatus.result) && + Objects.equals(this.failedTelephoneNumbers, lookupStatus.failedTelephoneNumbers)&& + Objects.equals(this.additionalProperties, lookupStatus.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(requestId, status, result, failedTelephoneNumbers, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LookupStatus {\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" failedTelephoneNumbers: ").append(toIndentedString(failedTelephoneNumbers)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("requestId"); + openapiFields.add("status"); + openapiFields.add("result"); + openapiFields.add("failedTelephoneNumbers"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LookupStatus + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LookupStatus.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LookupStatus is not found in the empty JSON string", LookupStatus.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) && !jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestId").toString())); + } + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + JsonArray jsonArrayresult = jsonObj.getAsJsonArray("result"); + if (jsonArrayresult != null) { + // ensure the json data is an array + if (!jsonObj.get("result").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `result` to be an array in the JSON string but got `%s`", jsonObj.get("result").toString())); + } + + // validate the optional field `result` (array) + for (int i = 0; i < jsonArrayresult.size(); i++) { + LookupResult.validateJsonElement(jsonArrayresult.get(i)); + }; + } + } + // ensure the optional json data is an array if present + if (jsonObj.get("failedTelephoneNumbers") != null && !jsonObj.get("failedTelephoneNumbers").isJsonNull() && !jsonObj.get("failedTelephoneNumbers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `failedTelephoneNumbers` to be an array in the JSON string but got `%s`", jsonObj.get("failedTelephoneNumbers").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LookupStatus.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LookupStatus' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LookupStatus.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LookupStatus value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public LookupStatus read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + LookupStatus instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of LookupStatus given an JSON string + * + * @param jsonString JSON string + * @return An instance of LookupStatus + * @throws IOException if the JSON string is invalid with respect to LookupStatus + */ + public static LookupStatus fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LookupStatus.class); + } + + /** + * Convert an instance of LookupStatus to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java new file mode 100644 index 00000000..205bb514 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/LookupStatusEnum.java @@ -0,0 +1,76 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The status of the request (IN_PROGRESS, COMPLETE, PARTIAL_COMPLETE, or FAILED). + */ +@JsonAdapter(LookupStatusEnum.Adapter.class) +public enum LookupStatusEnum { + + IN_PROGRESS("IN_PROGRESS"), + + COMPLETE("COMPLETE"), + + PARTIAL_COMPLETE("PARTIAL_COMPLETE"), + + FAILED("FAILED"); + + private String value; + + LookupStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LookupStatusEnum fromValue(String value) { + for (LookupStatusEnum b : LookupStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LookupStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LookupStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LookupStatusEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java new file mode 100644 index 00000000..d6a944e1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallback.java @@ -0,0 +1,689 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.MachineDetectionResult; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * This event is sent to the url informed when requesting a machine detection operation. It contains the machine detection operation result, which can be: human, answering-machine, silence, timeout, error. This event is not sent when sync answering machine detection mode is chosen. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MachineDetectionCompleteCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MACHINE_DETECTION_RESULT = "machineDetectionResult"; + @SerializedName(SERIALIZED_NAME_MACHINE_DETECTION_RESULT) + private MachineDetectionResult machineDetectionResult; + + public MachineDetectionCompleteCallback() { + } + + public MachineDetectionCompleteCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public MachineDetectionCompleteCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public MachineDetectionCompleteCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public MachineDetectionCompleteCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public MachineDetectionCompleteCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public MachineDetectionCompleteCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public MachineDetectionCompleteCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public MachineDetectionCompleteCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public MachineDetectionCompleteCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public MachineDetectionCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public MachineDetectionCompleteCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public MachineDetectionCompleteCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public MachineDetectionCompleteCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public MachineDetectionCompleteCallback machineDetectionResult(MachineDetectionResult machineDetectionResult) { + + this.machineDetectionResult = machineDetectionResult; + return this; + } + + /** + * Get machineDetectionResult + * @return machineDetectionResult + **/ + @javax.annotation.Nullable + public MachineDetectionResult getMachineDetectionResult() { + return machineDetectionResult; + } + + + public void setMachineDetectionResult(MachineDetectionResult machineDetectionResult) { + this.machineDetectionResult = machineDetectionResult; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MachineDetectionCompleteCallback instance itself + */ + public MachineDetectionCompleteCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MachineDetectionCompleteCallback machineDetectionCompleteCallback = (MachineDetectionCompleteCallback) o; + return Objects.equals(this.eventType, machineDetectionCompleteCallback.eventType) && + Objects.equals(this.eventTime, machineDetectionCompleteCallback.eventTime) && + Objects.equals(this.accountId, machineDetectionCompleteCallback.accountId) && + Objects.equals(this.applicationId, machineDetectionCompleteCallback.applicationId) && + Objects.equals(this.from, machineDetectionCompleteCallback.from) && + Objects.equals(this.to, machineDetectionCompleteCallback.to) && + Objects.equals(this.direction, machineDetectionCompleteCallback.direction) && + Objects.equals(this.callId, machineDetectionCompleteCallback.callId) && + Objects.equals(this.callUrl, machineDetectionCompleteCallback.callUrl) && + Objects.equals(this.enqueuedTime, machineDetectionCompleteCallback.enqueuedTime) && + Objects.equals(this.startTime, machineDetectionCompleteCallback.startTime) && + Objects.equals(this.answerTime, machineDetectionCompleteCallback.answerTime) && + Objects.equals(this.tag, machineDetectionCompleteCallback.tag) && + Objects.equals(this.machineDetectionResult, machineDetectionCompleteCallback.machineDetectionResult)&& + Objects.equals(this.additionalProperties, machineDetectionCompleteCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, machineDetectionResult, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineDetectionCompleteCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" machineDetectionResult: ").append(toIndentedString(machineDetectionResult)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("machineDetectionResult"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MachineDetectionCompleteCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineDetectionCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MachineDetectionCompleteCallback is not found in the empty JSON string", MachineDetectionCompleteCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // validate the optional field `machineDetectionResult` + if (jsonObj.get("machineDetectionResult") != null && !jsonObj.get("machineDetectionResult").isJsonNull()) { + MachineDetectionResult.validateJsonElement(jsonObj.get("machineDetectionResult")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineDetectionCompleteCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineDetectionCompleteCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MachineDetectionCompleteCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineDetectionCompleteCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MachineDetectionCompleteCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineDetectionCompleteCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MachineDetectionCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionCompleteCallback + * @throws IOException if the JSON string is invalid with respect to MachineDetectionCompleteCallback + */ + public static MachineDetectionCompleteCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineDetectionCompleteCallback.class); + } + + /** + * Convert an instance of MachineDetectionCompleteCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java new file mode 100644 index 00000000..dce2e237 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionConfiguration.java @@ -0,0 +1,707 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.MachineDetectionModeEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The machine detection request used to perform <a href='/docs/voice/guides/machineDetection'>machine detection</a> on the call. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MachineDetectionConfiguration { + public static final String SERIALIZED_NAME_MODE = "mode"; + @SerializedName(SERIALIZED_NAME_MODE) + private MachineDetectionModeEnum mode = MachineDetectionModeEnum.ASYNC; + + public static final String SERIALIZED_NAME_DETECTION_TIMEOUT = "detectionTimeout"; + @SerializedName(SERIALIZED_NAME_DETECTION_TIMEOUT) + private Double detectionTimeout = 15d; + + public static final String SERIALIZED_NAME_SILENCE_TIMEOUT = "silenceTimeout"; + @SerializedName(SERIALIZED_NAME_SILENCE_TIMEOUT) + private Double silenceTimeout = 10d; + + public static final String SERIALIZED_NAME_SPEECH_THRESHOLD = "speechThreshold"; + @SerializedName(SERIALIZED_NAME_SPEECH_THRESHOLD) + private Double speechThreshold = 10d; + + public static final String SERIALIZED_NAME_SPEECH_END_THRESHOLD = "speechEndThreshold"; + @SerializedName(SERIALIZED_NAME_SPEECH_END_THRESHOLD) + private Double speechEndThreshold = 5d; + + public static final String SERIALIZED_NAME_MACHINE_SPEECH_END_THRESHOLD = "machineSpeechEndThreshold"; + @SerializedName(SERIALIZED_NAME_MACHINE_SPEECH_END_THRESHOLD) + private Double machineSpeechEndThreshold; + + public static final String SERIALIZED_NAME_DELAY_RESULT = "delayResult"; + @SerializedName(SERIALIZED_NAME_DELAY_RESULT) + private Boolean delayResult = false; + + public static final String SERIALIZED_NAME_CALLBACK_URL = "callbackUrl"; + @SerializedName(SERIALIZED_NAME_CALLBACK_URL) + private URI callbackUrl; + + public static final String SERIALIZED_NAME_CALLBACK_METHOD = "callbackMethod"; + @SerializedName(SERIALIZED_NAME_CALLBACK_METHOD) + private CallbackMethodEnum callbackMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_FALLBACK_URL = "fallbackUrl"; + @SerializedName(SERIALIZED_NAME_FALLBACK_URL) + private URI fallbackUrl; + + public static final String SERIALIZED_NAME_FALLBACK_METHOD = "fallbackMethod"; + @SerializedName(SERIALIZED_NAME_FALLBACK_METHOD) + private CallbackMethodEnum fallbackMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_FALLBACK_USERNAME = "fallbackUsername"; + @SerializedName(SERIALIZED_NAME_FALLBACK_USERNAME) + private String fallbackUsername; + + public static final String SERIALIZED_NAME_FALLBACK_PASSWORD = "fallbackPassword"; + @SerializedName(SERIALIZED_NAME_FALLBACK_PASSWORD) + private String fallbackPassword; + + public MachineDetectionConfiguration() { + } + + public MachineDetectionConfiguration mode(MachineDetectionModeEnum mode) { + + this.mode = mode; + return this; + } + + /** + * Get mode + * @return mode + **/ + @javax.annotation.Nullable + public MachineDetectionModeEnum getMode() { + return mode; + } + + + public void setMode(MachineDetectionModeEnum mode) { + this.mode = mode; + } + + + public MachineDetectionConfiguration detectionTimeout(Double detectionTimeout) { + + this.detectionTimeout = detectionTimeout; + return this; + } + + /** + * The timeout used for the whole operation, in seconds. If no result is determined in this period, a callback with a `timeout` result is sent. + * @return detectionTimeout + **/ + @javax.annotation.Nullable + public Double getDetectionTimeout() { + return detectionTimeout; + } + + + public void setDetectionTimeout(Double detectionTimeout) { + this.detectionTimeout = detectionTimeout; + } + + + public MachineDetectionConfiguration silenceTimeout(Double silenceTimeout) { + + this.silenceTimeout = silenceTimeout; + return this; + } + + /** + * If no speech is detected in this period, a callback with a 'silence' result is sent. + * @return silenceTimeout + **/ + @javax.annotation.Nullable + public Double getSilenceTimeout() { + return silenceTimeout; + } + + + public void setSilenceTimeout(Double silenceTimeout) { + this.silenceTimeout = silenceTimeout; + } + + + public MachineDetectionConfiguration speechThreshold(Double speechThreshold) { + + this.speechThreshold = speechThreshold; + return this; + } + + /** + * When speech has ended and a result couldn't be determined based on the audio content itself, this value is used to determine if the speaker is a machine based on the speech duration. If the length of the speech detected is greater than or equal to this threshold, the result will be 'answering-machine'. If the length of speech detected is below this threshold, the result will be 'human'. + * @return speechThreshold + **/ + @javax.annotation.Nullable + public Double getSpeechThreshold() { + return speechThreshold; + } + + + public void setSpeechThreshold(Double speechThreshold) { + this.speechThreshold = speechThreshold; + } + + + public MachineDetectionConfiguration speechEndThreshold(Double speechEndThreshold) { + + this.speechEndThreshold = speechEndThreshold; + return this; + } + + /** + * Amount of silence (in seconds) before assuming the callee has finished speaking. + * @return speechEndThreshold + **/ + @javax.annotation.Nullable + public Double getSpeechEndThreshold() { + return speechEndThreshold; + } + + + public void setSpeechEndThreshold(Double speechEndThreshold) { + this.speechEndThreshold = speechEndThreshold; + } + + + public MachineDetectionConfiguration machineSpeechEndThreshold(Double machineSpeechEndThreshold) { + + this.machineSpeechEndThreshold = machineSpeechEndThreshold; + return this; + } + + /** + * When an answering machine is detected, the amount of silence (in seconds) before assuming the message has finished playing. If not provided it will default to the speechEndThreshold value. + * @return machineSpeechEndThreshold + **/ + @javax.annotation.Nullable + public Double getMachineSpeechEndThreshold() { + return machineSpeechEndThreshold; + } + + + public void setMachineSpeechEndThreshold(Double machineSpeechEndThreshold) { + this.machineSpeechEndThreshold = machineSpeechEndThreshold; + } + + + public MachineDetectionConfiguration delayResult(Boolean delayResult) { + + this.delayResult = delayResult; + return this; + } + + /** + * If set to 'true' and if an answering machine is detected, the 'answering-machine' callback will be delayed until the machine is done speaking, or an end of message tone is detected, or until the 'detectionTimeout' is exceeded. If false, the 'answering-machine' result is sent immediately. + * @return delayResult + **/ + @javax.annotation.Nullable + public Boolean getDelayResult() { + return delayResult; + } + + + public void setDelayResult(Boolean delayResult) { + this.delayResult = delayResult; + } + + + public MachineDetectionConfiguration callbackUrl(URI callbackUrl) { + + this.callbackUrl = callbackUrl; + return this; + } + + /** + * The URL to send the 'machineDetectionComplete' webhook when the detection is completed. Only for 'async' mode. + * @return callbackUrl + **/ + @javax.annotation.Nullable + public URI getCallbackUrl() { + return callbackUrl; + } + + + public void setCallbackUrl(URI callbackUrl) { + this.callbackUrl = callbackUrl; + } + + + public MachineDetectionConfiguration callbackMethod(CallbackMethodEnum callbackMethod) { + + this.callbackMethod = callbackMethod; + return this; + } + + /** + * Get callbackMethod + * @return callbackMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getCallbackMethod() { + return callbackMethod; + } + + + public void setCallbackMethod(CallbackMethodEnum callbackMethod) { + this.callbackMethod = callbackMethod; + } + + + public MachineDetectionConfiguration username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public MachineDetectionConfiguration password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public MachineDetectionConfiguration fallbackUrl(URI fallbackUrl) { + + this.fallbackUrl = fallbackUrl; + return this; + } + + /** + * A fallback URL which, if provided, will be used to retry the machine detection complete webhook delivery in case `callbackUrl` fails to respond + * @return fallbackUrl + **/ + @javax.annotation.Nullable + public URI getFallbackUrl() { + return fallbackUrl; + } + + + public void setFallbackUrl(URI fallbackUrl) { + this.fallbackUrl = fallbackUrl; + } + + + public MachineDetectionConfiguration fallbackMethod(CallbackMethodEnum fallbackMethod) { + + this.fallbackMethod = fallbackMethod; + return this; + } + + /** + * Get fallbackMethod + * @return fallbackMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getFallbackMethod() { + return fallbackMethod; + } + + + public void setFallbackMethod(CallbackMethodEnum fallbackMethod) { + this.fallbackMethod = fallbackMethod; + } + + + public MachineDetectionConfiguration fallbackUsername(String fallbackUsername) { + + this.fallbackUsername = fallbackUsername; + return this; + } + + /** + * Basic auth username. + * @return fallbackUsername + **/ + @javax.annotation.Nullable + public String getFallbackUsername() { + return fallbackUsername; + } + + + public void setFallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; + } + + + public MachineDetectionConfiguration fallbackPassword(String fallbackPassword) { + + this.fallbackPassword = fallbackPassword; + return this; + } + + /** + * Basic auth password. + * @return fallbackPassword + **/ + @javax.annotation.Nullable + public String getFallbackPassword() { + return fallbackPassword; + } + + + public void setFallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MachineDetectionConfiguration instance itself + */ + public MachineDetectionConfiguration putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MachineDetectionConfiguration machineDetectionConfiguration = (MachineDetectionConfiguration) o; + return Objects.equals(this.mode, machineDetectionConfiguration.mode) && + Objects.equals(this.detectionTimeout, machineDetectionConfiguration.detectionTimeout) && + Objects.equals(this.silenceTimeout, machineDetectionConfiguration.silenceTimeout) && + Objects.equals(this.speechThreshold, machineDetectionConfiguration.speechThreshold) && + Objects.equals(this.speechEndThreshold, machineDetectionConfiguration.speechEndThreshold) && + Objects.equals(this.machineSpeechEndThreshold, machineDetectionConfiguration.machineSpeechEndThreshold) && + Objects.equals(this.delayResult, machineDetectionConfiguration.delayResult) && + Objects.equals(this.callbackUrl, machineDetectionConfiguration.callbackUrl) && + Objects.equals(this.callbackMethod, machineDetectionConfiguration.callbackMethod) && + Objects.equals(this.username, machineDetectionConfiguration.username) && + Objects.equals(this.password, machineDetectionConfiguration.password) && + Objects.equals(this.fallbackUrl, machineDetectionConfiguration.fallbackUrl) && + Objects.equals(this.fallbackMethod, machineDetectionConfiguration.fallbackMethod) && + Objects.equals(this.fallbackUsername, machineDetectionConfiguration.fallbackUsername) && + Objects.equals(this.fallbackPassword, machineDetectionConfiguration.fallbackPassword)&& + Objects.equals(this.additionalProperties, machineDetectionConfiguration.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(mode, detectionTimeout, silenceTimeout, speechThreshold, speechEndThreshold, machineSpeechEndThreshold, delayResult, callbackUrl, callbackMethod, username, password, fallbackUrl, fallbackMethod, fallbackUsername, fallbackPassword, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineDetectionConfiguration {\n"); + sb.append(" mode: ").append(toIndentedString(mode)).append("\n"); + sb.append(" detectionTimeout: ").append(toIndentedString(detectionTimeout)).append("\n"); + sb.append(" silenceTimeout: ").append(toIndentedString(silenceTimeout)).append("\n"); + sb.append(" speechThreshold: ").append(toIndentedString(speechThreshold)).append("\n"); + sb.append(" speechEndThreshold: ").append(toIndentedString(speechEndThreshold)).append("\n"); + sb.append(" machineSpeechEndThreshold: ").append(toIndentedString(machineSpeechEndThreshold)).append("\n"); + sb.append(" delayResult: ").append(toIndentedString(delayResult)).append("\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" callbackMethod: ").append(toIndentedString(callbackMethod)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" fallbackUrl: ").append(toIndentedString(fallbackUrl)).append("\n"); + sb.append(" fallbackMethod: ").append(toIndentedString(fallbackMethod)).append("\n"); + sb.append(" fallbackUsername: ").append(toIndentedString(fallbackUsername)).append("\n"); + sb.append(" fallbackPassword: ").append(toIndentedString(fallbackPassword)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("mode"); + openapiFields.add("detectionTimeout"); + openapiFields.add("silenceTimeout"); + openapiFields.add("speechThreshold"); + openapiFields.add("speechEndThreshold"); + openapiFields.add("machineSpeechEndThreshold"); + openapiFields.add("delayResult"); + openapiFields.add("callbackUrl"); + openapiFields.add("callbackMethod"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("fallbackUrl"); + openapiFields.add("fallbackMethod"); + openapiFields.add("fallbackUsername"); + openapiFields.add("fallbackPassword"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MachineDetectionConfiguration + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineDetectionConfiguration.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MachineDetectionConfiguration is not found in the empty JSON string", MachineDetectionConfiguration.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("fallbackUrl") != null && !jsonObj.get("fallbackUrl").isJsonNull()) && !jsonObj.get("fallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUrl").toString())); + } + if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); + } + if ((jsonObj.get("fallbackPassword") != null && !jsonObj.get("fallbackPassword").isJsonNull()) && !jsonObj.get("fallbackPassword").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackPassword` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackPassword").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineDetectionConfiguration.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineDetectionConfiguration' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MachineDetectionConfiguration.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineDetectionConfiguration value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MachineDetectionConfiguration read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineDetectionConfiguration instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MachineDetectionConfiguration given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionConfiguration + * @throws IOException if the JSON string is invalid with respect to MachineDetectionConfiguration + */ + public static MachineDetectionConfiguration fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineDetectionConfiguration.class); + } + + /** + * Convert an instance of MachineDetectionConfiguration to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java new file mode 100644 index 00000000..a8dfc31b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionModeEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The machine detection mode. If set to 'async', the detection result will be sent in a 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for the machine detection to complete and will include its result. + */ +@JsonAdapter(MachineDetectionModeEnum.Adapter.class) +public enum MachineDetectionModeEnum { + + SYNC("sync"), + + ASYNC("async"); + + private String value; + + MachineDetectionModeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MachineDetectionModeEnum fromValue(String value) { + for (MachineDetectionModeEnum b : MachineDetectionModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MachineDetectionModeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MachineDetectionModeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MachineDetectionModeEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java new file mode 100644 index 00000000..d0c8d20f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MachineDetectionResult.java @@ -0,0 +1,316 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * (optional) if machine detection was requested in sync mode, the result will be specified here. Possible values are the same as the async counterpart: Machine Detection Complete + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MachineDetectionResult { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public MachineDetectionResult() { + } + + public MachineDetectionResult value(String value) { + + this.value = value; + return this; + } + + /** + * Possible values are answering-machine, human, silence, timeout, or error. + * @return value + **/ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + } + + + public MachineDetectionResult duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The amount of time it took to determine the result. + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MachineDetectionResult instance itself + */ + public MachineDetectionResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MachineDetectionResult machineDetectionResult = (MachineDetectionResult) o; + return Objects.equals(this.value, machineDetectionResult.value) && + Objects.equals(this.duration, machineDetectionResult.duration)&& + Objects.equals(this.additionalProperties, machineDetectionResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(value, duration, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MachineDetectionResult {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("duration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MachineDetectionResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MachineDetectionResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MachineDetectionResult is not found in the empty JSON string", MachineDetectionResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MachineDetectionResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MachineDetectionResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MachineDetectionResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MachineDetectionResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MachineDetectionResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MachineDetectionResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MachineDetectionResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of MachineDetectionResult + * @throws IOException if the JSON string is invalid with respect to MachineDetectionResult + */ + public static MachineDetectionResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MachineDetectionResult.class); + } + + /** + * Convert an instance of MachineDetectionResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Media.java b/src/main/java/com/bandwidth/sdk/model/Media.java new file mode 100644 index 00000000..21f2455d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Media.java @@ -0,0 +1,344 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Media + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Media { + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + private String content; + + public static final String SERIALIZED_NAME_CONTENT_LENGTH = "contentLength"; + @SerializedName(SERIALIZED_NAME_CONTENT_LENGTH) + private Integer contentLength; + + public static final String SERIALIZED_NAME_MEDIA_NAME = "mediaName"; + @SerializedName(SERIALIZED_NAME_MEDIA_NAME) + private String mediaName; + + public Media() { + } + + public Media content(String content) { + + this.content = content; + return this; + } + + /** + * Get content + * @return content + **/ + @javax.annotation.Nullable + public String getContent() { + return content; + } + + + public void setContent(String content) { + this.content = content; + } + + + public Media contentLength(Integer contentLength) { + + this.contentLength = contentLength; + return this; + } + + /** + * Get contentLength + * @return contentLength + **/ + @javax.annotation.Nullable + public Integer getContentLength() { + return contentLength; + } + + + public void setContentLength(Integer contentLength) { + this.contentLength = contentLength; + } + + + public Media mediaName(String mediaName) { + + this.mediaName = mediaName; + return this; + } + + /** + * Get mediaName + * @return mediaName + **/ + @javax.annotation.Nullable + public String getMediaName() { + return mediaName; + } + + + public void setMediaName(String mediaName) { + this.mediaName = mediaName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Media instance itself + */ + public Media putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Media media = (Media) o; + return Objects.equals(this.content, media.content) && + Objects.equals(this.contentLength, media.contentLength) && + Objects.equals(this.mediaName, media.mediaName)&& + Objects.equals(this.additionalProperties, media.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(content, contentLength, mediaName, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Media {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" contentLength: ").append(toIndentedString(contentLength)).append("\n"); + sb.append(" mediaName: ").append(toIndentedString(mediaName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("content"); + openapiFields.add("contentLength"); + openapiFields.add("mediaName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Media + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Media.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Media is not found in the empty JSON string", Media.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) && !jsonObj.get("content").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); + } + if ((jsonObj.get("mediaName") != null && !jsonObj.get("mediaName").isJsonNull()) && !jsonObj.get("mediaName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Media.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Media' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Media.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Media value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Media read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Media instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Media given an JSON string + * + * @param jsonString JSON string + * @return An instance of Media + * @throws IOException if the JSON string is invalid with respect to Media + */ + public static Media fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Media.class); + } + + /** + * Convert an instance of Media to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Message.java b/src/main/java/com/bandwidth/sdk/model/Message.java new file mode 100644 index 00000000..4a9d1325 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Message.java @@ -0,0 +1,665 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Message { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private Set media; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public static final String SERIALIZED_NAME_EXPIRATION = "expiration"; + @SerializedName(SERIALIZED_NAME_EXPIRATION) + private OffsetDateTime expiration; + + public Message() { + } + + public Message id(String id) { + + this.id = id; + return this; + } + + /** + * The id of the message. + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Message owner(String owner) { + + this.owner = owner; + return this; + } + + /** + * The Bandwidth phone number associated with the message. + * @return owner + **/ + @javax.annotation.Nullable + public String getOwner() { + return owner; + } + + + public void setOwner(String owner) { + this.owner = owner; + } + + + public Message applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The application ID associated with the message. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public Message time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * The datetime stamp of the message in ISO 8601 + * @return time + **/ + @javax.annotation.Nullable + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public Message segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * The number of segments the original message from the user is broken into before sending over to carrier networks. + * @return segmentCount + **/ + @javax.annotation.Nullable + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public Message direction(MessageDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public MessageDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(MessageDirectionEnum direction) { + this.direction = direction; + } + + + public Message to(Set to) { + + this.to = to; + return this; + } + + public Message addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * The phone number recipients of the message. + * @return to + **/ + @javax.annotation.Nullable + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public Message from(String from) { + + this.from = from; + return this; + } + + /** + * The phone number the message was sent from. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public Message media(Set media) { + + this.media = media; + return this; + } + + public Message addMediaItem(String mediaItem) { + if (this.media == null) { + this.media = new LinkedHashSet<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * The list of media URLs sent in the message. Including a `filename` field in the `Content-Disposition` header of the media linked with a URL will set the displayed file name. This is a best practice to ensure that your media has a readable file name. + * @return media + **/ + @javax.annotation.Nullable + public Set getMedia() { + return media; + } + + + public void setMedia(Set media) { + this.media = media; + } + + + public Message text(String text) { + + this.text = text; + return this; + } + + /** + * The contents of the message. + * @return text + **/ + @javax.annotation.Nullable + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Message tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * The custom string set by the user. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public Message priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nullable + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + + public Message expiration(OffsetDateTime expiration) { + + this.expiration = expiration; + return this; + } + + /** + * The expiration date-time set by the user. + * @return expiration + **/ + @javax.annotation.Nullable + public OffsetDateTime getExpiration() { + return expiration; + } + + + public void setExpiration(OffsetDateTime expiration) { + this.expiration = expiration; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Message instance itself + */ + public Message putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Message message = (Message) o; + return Objects.equals(this.id, message.id) && + Objects.equals(this.owner, message.owner) && + Objects.equals(this.applicationId, message.applicationId) && + Objects.equals(this.time, message.time) && + Objects.equals(this.segmentCount, message.segmentCount) && + Objects.equals(this.direction, message.direction) && + Objects.equals(this.to, message.to) && + Objects.equals(this.from, message.from) && + Objects.equals(this.media, message.media) && + Objects.equals(this.text, message.text) && + Objects.equals(this.tag, message.tag) && + Objects.equals(this.priority, message.priority) && + Objects.equals(this.expiration, message.expiration)&& + Objects.equals(this.additionalProperties, message.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, media, text, tag, priority, expiration, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Message {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" expiration: ").append(toIndentedString(expiration)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("media"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("priority"); + openapiFields.add("expiration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Message + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Message.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Message is not found in the empty JSON string", Message.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("owner") != null && !jsonObj.get("owner").isJsonNull()) && !jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull() && !jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Message.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Message' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Message.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Message value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Message read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Message instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Message given an JSON string + * + * @param jsonString JSON string + * @return An instance of Message + * @throws IOException if the JSON string is invalid with respect to Message + */ + public static Message fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Message.class); + } + + /** + * Convert an instance of Message to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java new file mode 100644 index 00000000..e5daaaad --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDeliveredCallbackMessage; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Delivered Callback + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageDeliveredCallback { + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private MessageDeliveredCallbackMessage message; + + public MessageDeliveredCallback() { + } + + public MessageDeliveredCallback time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageDeliveredCallback type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessageDeliveredCallback to(String to) { + + this.to = to; + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public MessageDeliveredCallback description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public MessageDeliveredCallback message(MessageDeliveredCallbackMessage message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nonnull + public MessageDeliveredCallbackMessage getMessage() { + return message; + } + + + public void setMessage(MessageDeliveredCallbackMessage message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageDeliveredCallback instance itself + */ + public MessageDeliveredCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageDeliveredCallback messageDeliveredCallback = (MessageDeliveredCallback) o; + return Objects.equals(this.time, messageDeliveredCallback.time) && + Objects.equals(this.type, messageDeliveredCallback.type) && + Objects.equals(this.to, messageDeliveredCallback.to) && + Objects.equals(this.description, messageDeliveredCallback.description) && + Objects.equals(this.message, messageDeliveredCallback.message)&& + Objects.equals(this.additionalProperties, messageDeliveredCallback.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(time, type, to, description, message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageDeliveredCallback {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("type"); + openapiFields.add("to"); + openapiFields.add("description"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageDeliveredCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageDeliveredCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageDeliveredCallback is not found in the empty JSON string", MessageDeliveredCallback.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageDeliveredCallback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `message` + MessageDeliveredCallbackMessage.validateJsonElement(jsonObj.get("message")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageDeliveredCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageDeliveredCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageDeliveredCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageDeliveredCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageDeliveredCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageDeliveredCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageDeliveredCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageDeliveredCallback + * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallback + */ + public static MessageDeliveredCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageDeliveredCallback.class); + } + + /** + * Convert an instance of MessageDeliveredCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java new file mode 100644 index 00000000..772fdffb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessage.java @@ -0,0 +1,659 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Delivered Callback Message Schema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageDeliveredCallbackMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private List media; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public MessageDeliveredCallbackMessage() { + } + + public MessageDeliveredCallbackMessage id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public MessageDeliveredCallbackMessage owner(String owner) { + + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + **/ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + + public void setOwner(String owner) { + this.owner = owner; + } + + + public MessageDeliveredCallbackMessage applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public MessageDeliveredCallbackMessage time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageDeliveredCallbackMessage segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * Get segmentCount + * @return segmentCount + **/ + @javax.annotation.Nonnull + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public MessageDeliveredCallbackMessage direction(MessageDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(MessageDirectionEnum direction) { + this.direction = direction; + } + + + public MessageDeliveredCallbackMessage to(Set to) { + + this.to = to; + return this; + } + + public MessageDeliveredCallbackMessage addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public MessageDeliveredCallbackMessage from(String from) { + + this.from = from; + return this; + } + + /** + * Get from + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public MessageDeliveredCallbackMessage text(String text) { + + this.text = text; + return this; + } + + /** + * Get text + * @return text + **/ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public MessageDeliveredCallbackMessage tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + **/ + @javax.annotation.Nonnull + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public MessageDeliveredCallbackMessage media(List media) { + + this.media = media; + return this; + } + + public MessageDeliveredCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Get media + * @return media + **/ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + + public void setMedia(List media) { + this.media = media; + } + + + public MessageDeliveredCallbackMessage priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nullable + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageDeliveredCallbackMessage instance itself + */ + public MessageDeliveredCallbackMessage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageDeliveredCallbackMessage messageDeliveredCallbackMessage = (MessageDeliveredCallbackMessage) o; + return Objects.equals(this.id, messageDeliveredCallbackMessage.id) && + Objects.equals(this.owner, messageDeliveredCallbackMessage.owner) && + Objects.equals(this.applicationId, messageDeliveredCallbackMessage.applicationId) && + Objects.equals(this.time, messageDeliveredCallbackMessage.time) && + Objects.equals(this.segmentCount, messageDeliveredCallbackMessage.segmentCount) && + Objects.equals(this.direction, messageDeliveredCallbackMessage.direction) && + Objects.equals(this.to, messageDeliveredCallbackMessage.to) && + Objects.equals(this.from, messageDeliveredCallbackMessage.from) && + Objects.equals(this.text, messageDeliveredCallbackMessage.text) && + Objects.equals(this.tag, messageDeliveredCallbackMessage.tag) && + Objects.equals(this.media, messageDeliveredCallbackMessage.media) && + Objects.equals(this.priority, messageDeliveredCallbackMessage.priority)&& + Objects.equals(this.additionalProperties, messageDeliveredCallbackMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageDeliveredCallbackMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("media"); + openapiFields.add("priority"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("segmentCount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("tag"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageDeliveredCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageDeliveredCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageDeliveredCallbackMessage is not found in the empty JSON string", MessageDeliveredCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageDeliveredCallbackMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (!jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageDeliveredCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageDeliveredCallbackMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageDeliveredCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageDeliveredCallbackMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageDeliveredCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageDeliveredCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageDeliveredCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageDeliveredCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageDeliveredCallbackMessage + */ + public static MessageDeliveredCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageDeliveredCallbackMessage.class); + } + + /** + * Convert an instance of MessageDeliveredCallbackMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java new file mode 100644 index 00000000..16e61c8a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageDirectionEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The direction of the message. One of in out. + */ +@JsonAdapter(MessageDirectionEnum.Adapter.class) +public enum MessageDirectionEnum { + + IN("in"), + + OUT("out"); + + private String value; + + MessageDirectionEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MessageDirectionEnum fromValue(String value) { + for (MessageDirectionEnum b : MessageDirectionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MessageDirectionEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MessageDirectionEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MessageDirectionEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java new file mode 100644 index 00000000..7da714f7 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallback.java @@ -0,0 +1,448 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageFailedCallbackMessage; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Failed Callback + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageFailedCallback { + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private MessageFailedCallbackMessage message; + + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private Integer errorCode; + + public MessageFailedCallback() { + } + + public MessageFailedCallback time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageFailedCallback type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessageFailedCallback to(String to) { + + this.to = to; + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public MessageFailedCallback description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public MessageFailedCallback message(MessageFailedCallbackMessage message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nonnull + public MessageFailedCallbackMessage getMessage() { + return message; + } + + + public void setMessage(MessageFailedCallbackMessage message) { + this.message = message; + } + + + public MessageFailedCallback errorCode(Integer errorCode) { + + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + **/ + @javax.annotation.Nonnull + public Integer getErrorCode() { + return errorCode; + } + + + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageFailedCallback instance itself + */ + public MessageFailedCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageFailedCallback messageFailedCallback = (MessageFailedCallback) o; + return Objects.equals(this.time, messageFailedCallback.time) && + Objects.equals(this.type, messageFailedCallback.type) && + Objects.equals(this.to, messageFailedCallback.to) && + Objects.equals(this.description, messageFailedCallback.description) && + Objects.equals(this.message, messageFailedCallback.message) && + Objects.equals(this.errorCode, messageFailedCallback.errorCode)&& + Objects.equals(this.additionalProperties, messageFailedCallback.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(time, type, to, description, message, errorCode, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageFailedCallback {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("type"); + openapiFields.add("to"); + openapiFields.add("description"); + openapiFields.add("message"); + openapiFields.add("errorCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("errorCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageFailedCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageFailedCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageFailedCallback is not found in the empty JSON string", MessageFailedCallback.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageFailedCallback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `message` + MessageFailedCallbackMessage.validateJsonElement(jsonObj.get("message")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageFailedCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageFailedCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageFailedCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageFailedCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageFailedCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageFailedCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageFailedCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageFailedCallback + * @throws IOException if the JSON string is invalid with respect to MessageFailedCallback + */ + public static MessageFailedCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageFailedCallback.class); + } + + /** + * Convert an instance of MessageFailedCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java new file mode 100644 index 00000000..9e54d2cd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageFailedCallbackMessage.java @@ -0,0 +1,660 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Failed Callback Message Schema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageFailedCallbackMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private List media; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public MessageFailedCallbackMessage() { + } + + public MessageFailedCallbackMessage id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public MessageFailedCallbackMessage owner(String owner) { + + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + **/ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + + public void setOwner(String owner) { + this.owner = owner; + } + + + public MessageFailedCallbackMessage applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public MessageFailedCallbackMessage time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageFailedCallbackMessage segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * Get segmentCount + * @return segmentCount + **/ + @javax.annotation.Nonnull + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public MessageFailedCallbackMessage direction(MessageDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(MessageDirectionEnum direction) { + this.direction = direction; + } + + + public MessageFailedCallbackMessage to(Set to) { + + this.to = to; + return this; + } + + public MessageFailedCallbackMessage addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public MessageFailedCallbackMessage from(String from) { + + this.from = from; + return this; + } + + /** + * Get from + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public MessageFailedCallbackMessage text(String text) { + + this.text = text; + return this; + } + + /** + * Get text + * @return text + **/ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public MessageFailedCallbackMessage tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + **/ + @javax.annotation.Nonnull + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public MessageFailedCallbackMessage media(List media) { + + this.media = media; + return this; + } + + public MessageFailedCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Get media + * @return media + **/ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + + public void setMedia(List media) { + this.media = media; + } + + + public MessageFailedCallbackMessage priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nonnull + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageFailedCallbackMessage instance itself + */ + public MessageFailedCallbackMessage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageFailedCallbackMessage messageFailedCallbackMessage = (MessageFailedCallbackMessage) o; + return Objects.equals(this.id, messageFailedCallbackMessage.id) && + Objects.equals(this.owner, messageFailedCallbackMessage.owner) && + Objects.equals(this.applicationId, messageFailedCallbackMessage.applicationId) && + Objects.equals(this.time, messageFailedCallbackMessage.time) && + Objects.equals(this.segmentCount, messageFailedCallbackMessage.segmentCount) && + Objects.equals(this.direction, messageFailedCallbackMessage.direction) && + Objects.equals(this.to, messageFailedCallbackMessage.to) && + Objects.equals(this.from, messageFailedCallbackMessage.from) && + Objects.equals(this.text, messageFailedCallbackMessage.text) && + Objects.equals(this.tag, messageFailedCallbackMessage.tag) && + Objects.equals(this.media, messageFailedCallbackMessage.media) && + Objects.equals(this.priority, messageFailedCallbackMessage.priority)&& + Objects.equals(this.additionalProperties, messageFailedCallbackMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageFailedCallbackMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("media"); + openapiFields.add("priority"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("segmentCount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("tag"); + openapiRequiredFields.add("priority"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageFailedCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageFailedCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageFailedCallbackMessage is not found in the empty JSON string", MessageFailedCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageFailedCallbackMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (!jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageFailedCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageFailedCallbackMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageFailedCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageFailedCallbackMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageFailedCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageFailedCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageFailedCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageFailedCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageFailedCallbackMessage + */ + public static MessageFailedCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageFailedCallbackMessage.class); + } + + /** + * Convert an instance of MessageFailedCallbackMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageRequest.java b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java new file mode 100644 index 00000000..70a6a41a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageRequest.java @@ -0,0 +1,533 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MessageRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageRequest { + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private List media; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public static final String SERIALIZED_NAME_EXPIRATION = "expiration"; + @SerializedName(SERIALIZED_NAME_EXPIRATION) + private OffsetDateTime expiration; + + public MessageRequest() { + } + + public MessageRequest applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The ID of the Application your from number is associated with in the Bandwidth Phone Number Dashboard. + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public MessageRequest to(Set to) { + + this.to = to; + return this; + } + + public MessageRequest addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * The phone number(s) the message should be sent to in E164 format. + * @return to + **/ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public MessageRequest from(String from) { + + this.from = from; + return this; + } + + /** + * One of your telephone numbers the message should come from in E164 format. + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public MessageRequest text(String text) { + + this.text = text; + return this; + } + + /** + * The contents of the text message. Must be 2048 characters or less. + * @return text + **/ + @javax.annotation.Nullable + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public MessageRequest media(List media) { + + this.media = media; + return this; + } + + public MessageRequest addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * A list of URLs to include as media attachments as part of the message. Each URL can be at most 4096 characters. + * @return media + **/ + @javax.annotation.Nullable + public List getMedia() { + return media; + } + + + public void setMedia(List media) { + this.media = media; + } + + + public MessageRequest tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * A custom string that will be included in callback events of the message. Max 1024 characters. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public MessageRequest priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nullable + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + + public MessageRequest expiration(OffsetDateTime expiration) { + + this.expiration = expiration; + return this; + } + + /** + * A string with the date/time value that the message will automatically expire by. This must be a valid RFC-3339 value, e.g., 2021-03-14T01:59:26Z or 2021-03-13T20:59:26-05:00. Must be a date-time in the future. Not supported on MMS. + * @return expiration + **/ + @javax.annotation.Nullable + public OffsetDateTime getExpiration() { + return expiration; + } + + + public void setExpiration(OffsetDateTime expiration) { + this.expiration = expiration; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageRequest instance itself + */ + public MessageRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageRequest messageRequest = (MessageRequest) o; + return Objects.equals(this.applicationId, messageRequest.applicationId) && + Objects.equals(this.to, messageRequest.to) && + Objects.equals(this.from, messageRequest.from) && + Objects.equals(this.text, messageRequest.text) && + Objects.equals(this.media, messageRequest.media) && + Objects.equals(this.tag, messageRequest.tag) && + Objects.equals(this.priority, messageRequest.priority) && + Objects.equals(this.expiration, messageRequest.expiration)&& + Objects.equals(this.additionalProperties, messageRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(applicationId, to, from, text, media, tag, priority, expiration, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageRequest {\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" expiration: ").append(toIndentedString(expiration)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("applicationId"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("media"); + openapiFields.add("tag"); + openapiFields.add("priority"); + openapiFields.add("expiration"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageRequest is not found in the empty JSON string", MessageRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull() && !jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageRequest + * @throws IOException if the JSON string is invalid with respect to MessageRequest + */ + public static MessageRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageRequest.class); + } + + /** + * Convert an instance of MessageRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java new file mode 100644 index 00000000..3936d61a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallback.java @@ -0,0 +1,419 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageSendingCallbackMessage; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Sending Callback + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageSendingCallback { + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private MessageSendingCallbackMessage message; + + public MessageSendingCallback() { + } + + public MessageSendingCallback time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageSendingCallback type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessageSendingCallback to(String to) { + + this.to = to; + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public MessageSendingCallback description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public MessageSendingCallback message(MessageSendingCallbackMessage message) { + + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @javax.annotation.Nonnull + public MessageSendingCallbackMessage getMessage() { + return message; + } + + + public void setMessage(MessageSendingCallbackMessage message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageSendingCallback instance itself + */ + public MessageSendingCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageSendingCallback messageSendingCallback = (MessageSendingCallback) o; + return Objects.equals(this.time, messageSendingCallback.time) && + Objects.equals(this.type, messageSendingCallback.type) && + Objects.equals(this.to, messageSendingCallback.to) && + Objects.equals(this.description, messageSendingCallback.description) && + Objects.equals(this.message, messageSendingCallback.message)&& + Objects.equals(this.additionalProperties, messageSendingCallback.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(time, type, to, description, message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageSendingCallback {\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("time"); + openapiFields.add("type"); + openapiFields.add("to"); + openapiFields.add("description"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageSendingCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageSendingCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageSendingCallback is not found in the empty JSON string", MessageSendingCallback.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageSendingCallback.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the required field `message` + MessageSendingCallbackMessage.validateJsonElement(jsonObj.get("message")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageSendingCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageSendingCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageSendingCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageSendingCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageSendingCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageSendingCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageSendingCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageSendingCallback + * @throws IOException if the JSON string is invalid with respect to MessageSendingCallback + */ + public static MessageSendingCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageSendingCallback.class); + } + + /** + * Convert an instance of MessageSendingCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java new file mode 100644 index 00000000..36ff548e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageSendingCallbackMessage.java @@ -0,0 +1,662 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Message Sending Callback Message Schema + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessageSendingCallbackMessage { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_OWNER = "owner"; + @SerializedName(SERIALIZED_NAME_OWNER) + private String owner; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_TIME = "time"; + @SerializedName(SERIALIZED_NAME_TIME) + private OffsetDateTime time; + + public static final String SERIALIZED_NAME_SEGMENT_COUNT = "segmentCount"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COUNT) + private Integer segmentCount; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private MessageDirectionEnum direction; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private Set to = new LinkedHashSet<>(); + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_MEDIA = "media"; + @SerializedName(SERIALIZED_NAME_MEDIA) + private List media = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + private PriorityEnum priority; + + public MessageSendingCallbackMessage() { + } + + public MessageSendingCallbackMessage id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public MessageSendingCallbackMessage owner(String owner) { + + this.owner = owner; + return this; + } + + /** + * Get owner + * @return owner + **/ + @javax.annotation.Nonnull + public String getOwner() { + return owner; + } + + + public void setOwner(String owner) { + this.owner = owner; + } + + + public MessageSendingCallbackMessage applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * Get applicationId + * @return applicationId + **/ + @javax.annotation.Nonnull + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public MessageSendingCallbackMessage time(OffsetDateTime time) { + + this.time = time; + return this; + } + + /** + * Get time + * @return time + **/ + @javax.annotation.Nonnull + public OffsetDateTime getTime() { + return time; + } + + + public void setTime(OffsetDateTime time) { + this.time = time; + } + + + public MessageSendingCallbackMessage segmentCount(Integer segmentCount) { + + this.segmentCount = segmentCount; + return this; + } + + /** + * Get segmentCount + * @return segmentCount + **/ + @javax.annotation.Nonnull + public Integer getSegmentCount() { + return segmentCount; + } + + + public void setSegmentCount(Integer segmentCount) { + this.segmentCount = segmentCount; + } + + + public MessageSendingCallbackMessage direction(MessageDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nonnull + public MessageDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(MessageDirectionEnum direction) { + this.direction = direction; + } + + + public MessageSendingCallbackMessage to(Set to) { + + this.to = to; + return this; + } + + public MessageSendingCallbackMessage addToItem(String toItem) { + if (this.to == null) { + this.to = new LinkedHashSet<>(); + } + this.to.add(toItem); + return this; + } + + /** + * Get to + * @return to + **/ + @javax.annotation.Nonnull + public Set getTo() { + return to; + } + + + public void setTo(Set to) { + this.to = to; + } + + + public MessageSendingCallbackMessage from(String from) { + + this.from = from; + return this; + } + + /** + * Get from + * @return from + **/ + @javax.annotation.Nonnull + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public MessageSendingCallbackMessage text(String text) { + + this.text = text; + return this; + } + + /** + * Get text + * @return text + **/ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public MessageSendingCallbackMessage tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * Get tag + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public MessageSendingCallbackMessage media(List media) { + + this.media = media; + return this; + } + + public MessageSendingCallbackMessage addMediaItem(URI mediaItem) { + if (this.media == null) { + this.media = new ArrayList<>(); + } + this.media.add(mediaItem); + return this; + } + + /** + * Get media + * @return media + **/ + @javax.annotation.Nonnull + public List getMedia() { + return media; + } + + + public void setMedia(List media) { + this.media = media; + } + + + public MessageSendingCallbackMessage priority(PriorityEnum priority) { + + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + **/ + @javax.annotation.Nonnull + public PriorityEnum getPriority() { + return priority; + } + + + public void setPriority(PriorityEnum priority) { + this.priority = priority; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessageSendingCallbackMessage instance itself + */ + public MessageSendingCallbackMessage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessageSendingCallbackMessage messageSendingCallbackMessage = (MessageSendingCallbackMessage) o; + return Objects.equals(this.id, messageSendingCallbackMessage.id) && + Objects.equals(this.owner, messageSendingCallbackMessage.owner) && + Objects.equals(this.applicationId, messageSendingCallbackMessage.applicationId) && + Objects.equals(this.time, messageSendingCallbackMessage.time) && + Objects.equals(this.segmentCount, messageSendingCallbackMessage.segmentCount) && + Objects.equals(this.direction, messageSendingCallbackMessage.direction) && + Objects.equals(this.to, messageSendingCallbackMessage.to) && + Objects.equals(this.from, messageSendingCallbackMessage.from) && + Objects.equals(this.text, messageSendingCallbackMessage.text) && + Objects.equals(this.tag, messageSendingCallbackMessage.tag) && + Objects.equals(this.media, messageSendingCallbackMessage.media) && + Objects.equals(this.priority, messageSendingCallbackMessage.priority)&& + Objects.equals(this.additionalProperties, messageSendingCallbackMessage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, owner, applicationId, time, segmentCount, direction, to, from, text, tag, media, priority, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessageSendingCallbackMessage {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" owner: ").append(toIndentedString(owner)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" time: ").append(toIndentedString(time)).append("\n"); + sb.append(" segmentCount: ").append(toIndentedString(segmentCount)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" media: ").append(toIndentedString(media)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("owner"); + openapiFields.add("applicationId"); + openapiFields.add("time"); + openapiFields.add("segmentCount"); + openapiFields.add("direction"); + openapiFields.add("to"); + openapiFields.add("from"); + openapiFields.add("text"); + openapiFields.add("tag"); + openapiFields.add("media"); + openapiFields.add("priority"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("owner"); + openapiRequiredFields.add("applicationId"); + openapiRequiredFields.add("time"); + openapiRequiredFields.add("segmentCount"); + openapiRequiredFields.add("direction"); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("from"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("media"); + openapiRequiredFields.add("priority"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessageSendingCallbackMessage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessageSendingCallbackMessage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessageSendingCallbackMessage is not found in the empty JSON string", MessageSendingCallbackMessage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessageSendingCallbackMessage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if (!jsonObj.get("owner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `owner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("owner").toString())); + } + if (!jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("to") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("to").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be an array in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if (!jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if (!jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // ensure the required json array is present + if (jsonObj.get("media") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("media").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `media` to be an array in the JSON string but got `%s`", jsonObj.get("media").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessageSendingCallbackMessage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessageSendingCallbackMessage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessageSendingCallbackMessage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessageSendingCallbackMessage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessageSendingCallbackMessage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessageSendingCallbackMessage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessageSendingCallbackMessage given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessageSendingCallbackMessage + * @throws IOException if the JSON string is invalid with respect to MessageSendingCallbackMessage + */ + public static MessageSendingCallbackMessage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessageSendingCallbackMessage.class); + } + + /** + * Convert an instance of MessageSendingCallbackMessage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java new file mode 100644 index 00000000..c21f19c4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageStatusEnum.java @@ -0,0 +1,84 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The status of the message. One of RECEIVED QUEUED SENDING SENT FAILED DELIVERED ACCEPTED UNDELIVERED. + */ +@JsonAdapter(MessageStatusEnum.Adapter.class) +public enum MessageStatusEnum { + + RECEIVED("RECEIVED"), + + QUEUED("QUEUED"), + + SENDING("SENDING"), + + SENT("SENT"), + + FAILED("FAILED"), + + DELIVERED("DELIVERED"), + + ACCEPTED("ACCEPTED"), + + UNDELIVERED("UNDELIVERED"); + + private String value; + + MessageStatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MessageStatusEnum fromValue(String value) { + for (MessageStatusEnum b : MessageStatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MessageStatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MessageStatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MessageStatusEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java b/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java new file mode 100644 index 00000000..268f4c42 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessageTypeEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The type of message. Either SMS or MMS. + */ +@JsonAdapter(MessageTypeEnum.Adapter.class) +public enum MessageTypeEnum { + + SMS("sms"), + + MMS("mms"); + + private String value; + + MessageTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MessageTypeEnum fromValue(String value) { + for (MessageTypeEnum b : MessageTypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MessageTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MessageTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MessageTypeEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessagesList.java b/src/main/java/com/bandwidth/sdk/model/MessagesList.java new file mode 100644 index 00000000..2853d56c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessagesList.java @@ -0,0 +1,368 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.ListMessageItem; +import com.bandwidth.sdk.model.PageInfo; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MessagesList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessagesList { + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + private Integer totalCount; + + public static final String SERIALIZED_NAME_PAGE_INFO = "pageInfo"; + @SerializedName(SERIALIZED_NAME_PAGE_INFO) + private PageInfo pageInfo; + + public static final String SERIALIZED_NAME_MESSAGES = "messages"; + @SerializedName(SERIALIZED_NAME_MESSAGES) + private List messages; + + public MessagesList() { + } + + public MessagesList totalCount(Integer totalCount) { + + this.totalCount = totalCount; + return this; + } + + /** + * The total number of messages matched by the search. When the request has limitTotalCount set to true this value is limited to 10,000. + * @return totalCount + **/ + @javax.annotation.Nullable + public Integer getTotalCount() { + return totalCount; + } + + + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + + public MessagesList pageInfo(PageInfo pageInfo) { + + this.pageInfo = pageInfo; + return this; + } + + /** + * Get pageInfo + * @return pageInfo + **/ + @javax.annotation.Nullable + public PageInfo getPageInfo() { + return pageInfo; + } + + + public void setPageInfo(PageInfo pageInfo) { + this.pageInfo = pageInfo; + } + + + public MessagesList messages(List messages) { + + this.messages = messages; + return this; + } + + public MessagesList addMessagesItem(ListMessageItem messagesItem) { + if (this.messages == null) { + this.messages = new ArrayList<>(); + } + this.messages.add(messagesItem); + return this; + } + + /** + * Get messages + * @return messages + **/ + @javax.annotation.Nullable + public List getMessages() { + return messages; + } + + + public void setMessages(List messages) { + this.messages = messages; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessagesList instance itself + */ + public MessagesList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagesList messagesList = (MessagesList) o; + return Objects.equals(this.totalCount, messagesList.totalCount) && + Objects.equals(this.pageInfo, messagesList.pageInfo) && + Objects.equals(this.messages, messagesList.messages)&& + Objects.equals(this.additionalProperties, messagesList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, pageInfo, messages, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagesList {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" pageInfo: ").append(toIndentedString(pageInfo)).append("\n"); + sb.append(" messages: ").append(toIndentedString(messages)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalCount"); + openapiFields.add("pageInfo"); + openapiFields.add("messages"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessagesList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessagesList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessagesList is not found in the empty JSON string", MessagesList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `pageInfo` + if (jsonObj.get("pageInfo") != null && !jsonObj.get("pageInfo").isJsonNull()) { + PageInfo.validateJsonElement(jsonObj.get("pageInfo")); + } + if (jsonObj.get("messages") != null && !jsonObj.get("messages").isJsonNull()) { + JsonArray jsonArraymessages = jsonObj.getAsJsonArray("messages"); + if (jsonArraymessages != null) { + // ensure the json data is an array + if (!jsonObj.get("messages").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `messages` to be an array in the JSON string but got `%s`", jsonObj.get("messages").toString())); + } + + // validate the optional field `messages` (array) + for (int i = 0; i < jsonArraymessages.size(); i++) { + ListMessageItem.validateJsonElement(jsonArraymessages.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessagesList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessagesList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessagesList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessagesList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessagesList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessagesList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessagesList given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagesList + * @throws IOException if the JSON string is invalid with respect to MessagesList + */ + public static MessagesList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessagesList.class); + } + + /** + * Convert an instance of MessagesList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java new file mode 100644 index 00000000..e5714d07 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessagingCodeResponse.java @@ -0,0 +1,285 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MessagingCodeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessagingCodeResponse { + public static final String SERIALIZED_NAME_MESSAGE_ID = "messageId"; + @SerializedName(SERIALIZED_NAME_MESSAGE_ID) + private String messageId; + + public MessagingCodeResponse() { + } + + public MessagingCodeResponse messageId(String messageId) { + + this.messageId = messageId; + return this; + } + + /** + * Messaging API Message ID. + * @return messageId + **/ + @javax.annotation.Nullable + public String getMessageId() { + return messageId; + } + + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessagingCodeResponse instance itself + */ + public MessagingCodeResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagingCodeResponse messagingCodeResponse = (MessagingCodeResponse) o; + return Objects.equals(this.messageId, messagingCodeResponse.messageId)&& + Objects.equals(this.additionalProperties, messagingCodeResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(messageId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagingCodeResponse {\n"); + sb.append(" messageId: ").append(toIndentedString(messageId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("messageId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessagingCodeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessagingCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessagingCodeResponse is not found in the empty JSON string", MessagingCodeResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("messageId") != null && !jsonObj.get("messageId").isJsonNull()) && !jsonObj.get("messageId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `messageId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessagingCodeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessagingCodeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessagingCodeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessagingCodeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessagingCodeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessagingCodeResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessagingCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagingCodeResponse + * @throws IOException if the JSON string is invalid with respect to MessagingCodeResponse + */ + public static MessagingCodeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessagingCodeResponse.class); + } + + /** + * Convert an instance of MessagingCodeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java new file mode 100644 index 00000000..14789cd4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MessagingRequestError.java @@ -0,0 +1,325 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MessagingRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MessagingRequestError { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public MessagingRequestError() { + } + + public MessagingRequestError type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nonnull + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public MessagingRequestError description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MessagingRequestError instance itself + */ + public MessagingRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MessagingRequestError messagingRequestError = (MessagingRequestError) o; + return Objects.equals(this.type, messagingRequestError.type) && + Objects.equals(this.description, messagingRequestError.description)&& + Objects.equals(this.additionalProperties, messagingRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MessagingRequestError {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("description"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MessagingRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MessagingRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MessagingRequestError is not found in the empty JSON string", MessagingRequestError.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MessagingRequestError.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MessagingRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MessagingRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MessagingRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MessagingRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MessagingRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MessagingRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MessagingRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MessagingRequestError + * @throws IOException if the JSON string is invalid with respect to MessagingRequestError + */ + public static MessagingRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MessagingRequestError.class); + } + + /** + * Convert an instance of MessagingRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java new file mode 100644 index 00000000..f80b3488 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MfaForbiddenRequestError.java @@ -0,0 +1,285 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MfaForbiddenRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MfaForbiddenRequestError { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public MfaForbiddenRequestError() { + } + + public MfaForbiddenRequestError message(String message) { + + this.message = message; + return this; + } + + /** + * The message containing the reason behind the request being forbidden. + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MfaForbiddenRequestError instance itself + */ + public MfaForbiddenRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MfaForbiddenRequestError mfaForbiddenRequestError = (MfaForbiddenRequestError) o; + return Objects.equals(this.message, mfaForbiddenRequestError.message)&& + Objects.equals(this.additionalProperties, mfaForbiddenRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MfaForbiddenRequestError {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MfaForbiddenRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MfaForbiddenRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MfaForbiddenRequestError is not found in the empty JSON string", MfaForbiddenRequestError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MfaForbiddenRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MfaForbiddenRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MfaForbiddenRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MfaForbiddenRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MfaForbiddenRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MfaForbiddenRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MfaForbiddenRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaForbiddenRequestError + * @throws IOException if the JSON string is invalid with respect to MfaForbiddenRequestError + */ + public static MfaForbiddenRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MfaForbiddenRequestError.class); + } + + /** + * Convert an instance of MfaForbiddenRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java new file mode 100644 index 00000000..313cbe68 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MfaRequestError.java @@ -0,0 +1,316 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MfaRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MfaRequestError { + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + private String error; + + public static final String SERIALIZED_NAME_REQUEST_ID = "requestId"; + @SerializedName(SERIALIZED_NAME_REQUEST_ID) + private String requestId; + + public MfaRequestError() { + } + + public MfaRequestError error(String error) { + + this.error = error; + return this; + } + + /** + * A message describing the error with your request. + * @return error + **/ + @javax.annotation.Nullable + public String getError() { + return error; + } + + + public void setError(String error) { + this.error = error; + } + + + public MfaRequestError requestId(String requestId) { + + this.requestId = requestId; + return this; + } + + /** + * The associated requestId from AWS. + * @return requestId + **/ + @javax.annotation.Nullable + public String getRequestId() { + return requestId; + } + + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MfaRequestError instance itself + */ + public MfaRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MfaRequestError mfaRequestError = (MfaRequestError) o; + return Objects.equals(this.error, mfaRequestError.error) && + Objects.equals(this.requestId, mfaRequestError.requestId)&& + Objects.equals(this.additionalProperties, mfaRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(error, requestId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MfaRequestError {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("error"); + openapiFields.add("requestId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MfaRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MfaRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MfaRequestError is not found in the empty JSON string", MfaRequestError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) && !jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + if ((jsonObj.get("requestId") != null && !jsonObj.get("requestId").isJsonNull()) && !jsonObj.get("requestId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `requestId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("requestId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MfaRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MfaRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MfaRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MfaRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MfaRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MfaRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MfaRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaRequestError + * @throws IOException if the JSON string is invalid with respect to MfaRequestError + */ + public static MfaRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MfaRequestError.class); + } + + /** + * Convert an instance of MfaRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java new file mode 100644 index 00000000..a2dc50cf --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestError.java @@ -0,0 +1,285 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * MfaUnauthorizedRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class MfaUnauthorizedRequestError { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public MfaUnauthorizedRequestError() { + } + + public MfaUnauthorizedRequestError message(String message) { + + this.message = message; + return this; + } + + /** + * Unauthorized + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MfaUnauthorizedRequestError instance itself + */ + public MfaUnauthorizedRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MfaUnauthorizedRequestError mfaUnauthorizedRequestError = (MfaUnauthorizedRequestError) o; + return Objects.equals(this.message, mfaUnauthorizedRequestError.message)&& + Objects.equals(this.additionalProperties, mfaUnauthorizedRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MfaUnauthorizedRequestError {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MfaUnauthorizedRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MfaUnauthorizedRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MfaUnauthorizedRequestError is not found in the empty JSON string", MfaUnauthorizedRequestError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MfaUnauthorizedRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MfaUnauthorizedRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MfaUnauthorizedRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MfaUnauthorizedRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MfaUnauthorizedRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MfaUnauthorizedRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MfaUnauthorizedRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of MfaUnauthorizedRequestError + * @throws IOException if the JSON string is invalid with respect to MfaUnauthorizedRequestError + */ + public static MfaUnauthorizedRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MfaUnauthorizedRequestError.class); + } + + /** + * Convert an instance of MfaUnauthorizedRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/PageInfo.java b/src/main/java/com/bandwidth/sdk/model/PageInfo.java new file mode 100644 index 00000000..b4011623 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/PageInfo.java @@ -0,0 +1,378 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * PageInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class PageInfo { + public static final String SERIALIZED_NAME_PREV_PAGE = "prevPage"; + @SerializedName(SERIALIZED_NAME_PREV_PAGE) + private String prevPage; + + public static final String SERIALIZED_NAME_NEXT_PAGE = "nextPage"; + @SerializedName(SERIALIZED_NAME_NEXT_PAGE) + private String nextPage; + + public static final String SERIALIZED_NAME_PREV_PAGE_TOKEN = "prevPageToken"; + @SerializedName(SERIALIZED_NAME_PREV_PAGE_TOKEN) + private String prevPageToken; + + public static final String SERIALIZED_NAME_NEXT_PAGE_TOKEN = "nextPageToken"; + @SerializedName(SERIALIZED_NAME_NEXT_PAGE_TOKEN) + private String nextPageToken; + + public PageInfo() { + } + + public PageInfo prevPage(String prevPage) { + + this.prevPage = prevPage; + return this; + } + + /** + * The link to the previous page for pagination. + * @return prevPage + **/ + @javax.annotation.Nullable + public String getPrevPage() { + return prevPage; + } + + + public void setPrevPage(String prevPage) { + this.prevPage = prevPage; + } + + + public PageInfo nextPage(String nextPage) { + + this.nextPage = nextPage; + return this; + } + + /** + * The link to the next page for pagination. + * @return nextPage + **/ + @javax.annotation.Nullable + public String getNextPage() { + return nextPage; + } + + + public void setNextPage(String nextPage) { + this.nextPage = nextPage; + } + + + public PageInfo prevPageToken(String prevPageToken) { + + this.prevPageToken = prevPageToken; + return this; + } + + /** + * The isolated pagination token for the previous page. + * @return prevPageToken + **/ + @javax.annotation.Nullable + public String getPrevPageToken() { + return prevPageToken; + } + + + public void setPrevPageToken(String prevPageToken) { + this.prevPageToken = prevPageToken; + } + + + public PageInfo nextPageToken(String nextPageToken) { + + this.nextPageToken = nextPageToken; + return this; + } + + /** + * The isolated pagination token for the next page. + * @return nextPageToken + **/ + @javax.annotation.Nullable + public String getNextPageToken() { + return nextPageToken; + } + + + public void setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PageInfo instance itself + */ + public PageInfo putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PageInfo pageInfo = (PageInfo) o; + return Objects.equals(this.prevPage, pageInfo.prevPage) && + Objects.equals(this.nextPage, pageInfo.nextPage) && + Objects.equals(this.prevPageToken, pageInfo.prevPageToken) && + Objects.equals(this.nextPageToken, pageInfo.nextPageToken)&& + Objects.equals(this.additionalProperties, pageInfo.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prevPage, nextPage, prevPageToken, nextPageToken, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PageInfo {\n"); + sb.append(" prevPage: ").append(toIndentedString(prevPage)).append("\n"); + sb.append(" nextPage: ").append(toIndentedString(nextPage)).append("\n"); + sb.append(" prevPageToken: ").append(toIndentedString(prevPageToken)).append("\n"); + sb.append(" nextPageToken: ").append(toIndentedString(nextPageToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("prevPage"); + openapiFields.add("nextPage"); + openapiFields.add("prevPageToken"); + openapiFields.add("nextPageToken"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PageInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PageInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PageInfo is not found in the empty JSON string", PageInfo.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("prevPage") != null && !jsonObj.get("prevPage").isJsonNull()) && !jsonObj.get("prevPage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prevPage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prevPage").toString())); + } + if ((jsonObj.get("nextPage") != null && !jsonObj.get("nextPage").isJsonNull()) && !jsonObj.get("nextPage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nextPage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nextPage").toString())); + } + if ((jsonObj.get("prevPageToken") != null && !jsonObj.get("prevPageToken").isJsonNull()) && !jsonObj.get("prevPageToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `prevPageToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("prevPageToken").toString())); + } + if ((jsonObj.get("nextPageToken") != null && !jsonObj.get("nextPageToken").isJsonNull()) && !jsonObj.get("nextPageToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nextPageToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nextPageToken").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PageInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PageInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PageInfo.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PageInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PageInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PageInfo instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PageInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of PageInfo + * @throws IOException if the JSON string is invalid with respect to PageInfo + */ + public static PageInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PageInfo.class); + } + + /** + * Convert an instance of PageInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java new file mode 100644 index 00000000..b50b8e8b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/PriorityEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The priority specified by the user. Not supported on MMS. + */ +@JsonAdapter(PriorityEnum.Adapter.class) +public enum PriorityEnum { + + DEFAULT("default"), + + HIGH("high"); + + private String value; + + PriorityEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static PriorityEnum fromValue(String value) { + for (PriorityEnum b : PriorityEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PriorityEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public PriorityEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PriorityEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java new file mode 100644 index 00000000..ff9120d1 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java @@ -0,0 +1,934 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Recording Available event is sent after a recording has been processed. It indicates that the recording is available for download. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class RecordingAvailableCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_CHANNELS = "channels"; + @SerializedName(SERIALIZED_NAME_CHANNELS) + private String channels; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public RecordingAvailableCallback() { + } + + public RecordingAvailableCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public RecordingAvailableCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public RecordingAvailableCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public RecordingAvailableCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public RecordingAvailableCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public RecordingAvailableCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public RecordingAvailableCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public RecordingAvailableCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public RecordingAvailableCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public RecordingAvailableCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public RecordingAvailableCallback recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public RecordingAvailableCallback mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public RecordingAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public RecordingAvailableCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public RecordingAvailableCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public RecordingAvailableCallback duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public RecordingAvailableCallback fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public RecordingAvailableCallback channels(String channels) { + + this.channels = channels; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return channels + **/ + @javax.annotation.Nullable + public String getChannels() { + return channels; + } + + + public void setChannels(String channels) { + this.channels = channels; + } + + + public RecordingAvailableCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public RecordingAvailableCallback status(String status) { + + this.status = status; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public RecordingAvailableCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public RecordingAvailableCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RecordingAvailableCallback instance itself + */ + public RecordingAvailableCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecordingAvailableCallback recordingAvailableCallback = (RecordingAvailableCallback) o; + return Objects.equals(this.eventType, recordingAvailableCallback.eventType) && + Objects.equals(this.eventTime, recordingAvailableCallback.eventTime) && + Objects.equals(this.accountId, recordingAvailableCallback.accountId) && + Objects.equals(this.applicationId, recordingAvailableCallback.applicationId) && + Objects.equals(this.from, recordingAvailableCallback.from) && + Objects.equals(this.to, recordingAvailableCallback.to) && + Objects.equals(this.direction, recordingAvailableCallback.direction) && + Objects.equals(this.callId, recordingAvailableCallback.callId) && + Objects.equals(this.callUrl, recordingAvailableCallback.callUrl) && + Objects.equals(this.parentCallId, recordingAvailableCallback.parentCallId) && + Objects.equals(this.recordingId, recordingAvailableCallback.recordingId) && + Objects.equals(this.mediaUrl, recordingAvailableCallback.mediaUrl) && + Objects.equals(this.enqueuedTime, recordingAvailableCallback.enqueuedTime) && + Objects.equals(this.startTime, recordingAvailableCallback.startTime) && + Objects.equals(this.endTime, recordingAvailableCallback.endTime) && + Objects.equals(this.duration, recordingAvailableCallback.duration) && + Objects.equals(this.fileFormat, recordingAvailableCallback.fileFormat) && + Objects.equals(this.channels, recordingAvailableCallback.channels) && + Objects.equals(this.tag, recordingAvailableCallback.tag) && + Objects.equals(this.status, recordingAvailableCallback.status) && + Objects.equals(this.transferCallerId, recordingAvailableCallback.transferCallerId) && + Objects.equals(this.transferTo, recordingAvailableCallback.transferTo)&& + Objects.equals(this.additionalProperties, recordingAvailableCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, parentCallId, recordingId, mediaUrl, enqueuedTime, startTime, endTime, duration, fileFormat, channels, tag, status, transferCallerId, transferTo, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecordingAvailableCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("parentCallId"); + openapiFields.add("recordingId"); + openapiFields.add("mediaUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("duration"); + openapiFields.add("fileFormat"); + openapiFields.add("channels"); + openapiFields.add("tag"); + openapiFields.add("status"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecordingAvailableCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecordingAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecordingAvailableCallback is not found in the empty JSON string", RecordingAvailableCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("channels") != null && !jsonObj.get("channels").isJsonNull()) && !jsonObj.get("channels").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `channels` to be a primitive type in the JSON string but got `%s`", jsonObj.get("channels").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecordingAvailableCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecordingAvailableCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecordingAvailableCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecordingAvailableCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RecordingAvailableCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RecordingAvailableCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecordingAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingAvailableCallback + * @throws IOException if the JSON string is invalid with respect to RecordingAvailableCallback + */ + public static RecordingAvailableCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecordingAvailableCallback.class); + } + + /** + * Convert an instance of RecordingAvailableCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java new file mode 100644 index 00000000..86dca1b8 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java @@ -0,0 +1,928 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Record Complete event is sent after a <Record> verb has executed if the call is still active. The BXML returned by this callback is executed next. When the recording is available for download, a Recording Available event will be sent. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class RecordingCompleteCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_CHANNELS = "channels"; + @SerializedName(SERIALIZED_NAME_CHANNELS) + private Integer channels; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public RecordingCompleteCallback() { + } + + public RecordingCompleteCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public RecordingCompleteCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public RecordingCompleteCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public RecordingCompleteCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public RecordingCompleteCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public RecordingCompleteCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public RecordingCompleteCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public RecordingCompleteCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public RecordingCompleteCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public RecordingCompleteCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public RecordingCompleteCallback recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public RecordingCompleteCallback mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public RecordingCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public RecordingCompleteCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public RecordingCompleteCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public RecordingCompleteCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public RecordingCompleteCallback duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public RecordingCompleteCallback fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public RecordingCompleteCallback channels(Integer channels) { + + this.channels = channels; + return this; + } + + /** + * Always `1` for conference recordings; multi-channel recordings are not supported on conferences. + * @return channels + **/ + @javax.annotation.Nullable + public Integer getChannels() { + return channels; + } + + + public void setChannels(Integer channels) { + this.channels = channels; + } + + + public RecordingCompleteCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public RecordingCompleteCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public RecordingCompleteCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RecordingCompleteCallback instance itself + */ + public RecordingCompleteCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecordingCompleteCallback recordingCompleteCallback = (RecordingCompleteCallback) o; + return Objects.equals(this.eventType, recordingCompleteCallback.eventType) && + Objects.equals(this.eventTime, recordingCompleteCallback.eventTime) && + Objects.equals(this.accountId, recordingCompleteCallback.accountId) && + Objects.equals(this.applicationId, recordingCompleteCallback.applicationId) && + Objects.equals(this.from, recordingCompleteCallback.from) && + Objects.equals(this.to, recordingCompleteCallback.to) && + Objects.equals(this.direction, recordingCompleteCallback.direction) && + Objects.equals(this.callId, recordingCompleteCallback.callId) && + Objects.equals(this.callUrl, recordingCompleteCallback.callUrl) && + Objects.equals(this.parentCallId, recordingCompleteCallback.parentCallId) && + Objects.equals(this.recordingId, recordingCompleteCallback.recordingId) && + Objects.equals(this.mediaUrl, recordingCompleteCallback.mediaUrl) && + Objects.equals(this.enqueuedTime, recordingCompleteCallback.enqueuedTime) && + Objects.equals(this.startTime, recordingCompleteCallback.startTime) && + Objects.equals(this.answerTime, recordingCompleteCallback.answerTime) && + Objects.equals(this.endTime, recordingCompleteCallback.endTime) && + Objects.equals(this.duration, recordingCompleteCallback.duration) && + Objects.equals(this.fileFormat, recordingCompleteCallback.fileFormat) && + Objects.equals(this.channels, recordingCompleteCallback.channels) && + Objects.equals(this.tag, recordingCompleteCallback.tag) && + Objects.equals(this.transferCallerId, recordingCompleteCallback.transferCallerId) && + Objects.equals(this.transferTo, recordingCompleteCallback.transferTo)&& + Objects.equals(this.additionalProperties, recordingCompleteCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, parentCallId, recordingId, mediaUrl, enqueuedTime, startTime, answerTime, endTime, duration, fileFormat, channels, tag, transferCallerId, transferTo, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecordingCompleteCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" channels: ").append(toIndentedString(channels)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("parentCallId"); + openapiFields.add("recordingId"); + openapiFields.add("mediaUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("endTime"); + openapiFields.add("duration"); + openapiFields.add("fileFormat"); + openapiFields.add("channels"); + openapiFields.add("tag"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecordingCompleteCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecordingCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RecordingCompleteCallback is not found in the empty JSON string", RecordingCompleteCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecordingCompleteCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecordingCompleteCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecordingCompleteCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecordingCompleteCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RecordingCompleteCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RecordingCompleteCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecordingCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingCompleteCallback + * @throws IOException if the JSON string is invalid with respect to RecordingCompleteCallback + */ + public static RecordingCompleteCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecordingCompleteCallback.class); + } + + /** + * Convert an instance of RecordingCompleteCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java new file mode 100644 index 00000000..ef78e6d6 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The recording state. Possible values: `paused` to pause an active recording `recording` to resume a paused recording + */ +@JsonAdapter(RecordingStateEnum.Adapter.class) +public enum RecordingStateEnum { + + PAUSED("paused"), + + RECORDING("recording"); + + private String value; + + RecordingStateEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RecordingStateEnum fromValue(String value) { + for (RecordingStateEnum b : RecordingStateEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RecordingStateEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RecordingStateEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RecordingStateEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java new file mode 100644 index 00000000..4e4a8b77 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RedirectCallback.java @@ -0,0 +1,749 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Redirect event is fired when a <Redirect> verb is executed. Its purpose is to get the next set of verbs from the calling application. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class RedirectCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public RedirectCallback() { + } + + public RedirectCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public RedirectCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public RedirectCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public RedirectCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public RedirectCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public RedirectCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public RedirectCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public RedirectCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public RedirectCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public RedirectCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public RedirectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public RedirectCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public RedirectCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public RedirectCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public RedirectCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public RedirectCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RedirectCallback instance itself + */ + public RedirectCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RedirectCallback redirectCallback = (RedirectCallback) o; + return Objects.equals(this.eventType, redirectCallback.eventType) && + Objects.equals(this.eventTime, redirectCallback.eventTime) && + Objects.equals(this.accountId, redirectCallback.accountId) && + Objects.equals(this.applicationId, redirectCallback.applicationId) && + Objects.equals(this.from, redirectCallback.from) && + Objects.equals(this.to, redirectCallback.to) && + Objects.equals(this.direction, redirectCallback.direction) && + Objects.equals(this.callId, redirectCallback.callId) && + Objects.equals(this.callUrl, redirectCallback.callUrl) && + Objects.equals(this.parentCallId, redirectCallback.parentCallId) && + Objects.equals(this.enqueuedTime, redirectCallback.enqueuedTime) && + Objects.equals(this.startTime, redirectCallback.startTime) && + Objects.equals(this.answerTime, redirectCallback.answerTime) && + Objects.equals(this.tag, redirectCallback.tag) && + Objects.equals(this.transferCallerId, redirectCallback.transferCallerId) && + Objects.equals(this.transferTo, redirectCallback.transferTo)&& + Objects.equals(this.additionalProperties, redirectCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, parentCallId, enqueuedTime, startTime, answerTime, tag, transferCallerId, transferTo, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RedirectCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("parentCallId"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RedirectCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RedirectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RedirectCallback is not found in the empty JSON string", RedirectCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RedirectCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RedirectCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RedirectCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RedirectCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RedirectCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RedirectCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RedirectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of RedirectCallback + * @throws IOException if the JSON string is invalid with respect to RedirectCallback + */ + public static RedirectCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RedirectCallback.class); + } + + /** + * Convert an instance of RedirectCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java new file mode 100644 index 00000000..2a524bc8 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RedirectMethodEnum.java @@ -0,0 +1,72 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * The HTTP method to use for the request to `redirectUrl`. GET or POST. Default value is POST.<br><br>Not allowed if `state` is `completed`. + */ +@JsonAdapter(RedirectMethodEnum.Adapter.class) +public enum RedirectMethodEnum { + + GET("GET"), + + POST("POST"); + + private String value; + + RedirectMethodEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RedirectMethodEnum fromValue(String value) { + for (RedirectMethodEnum b : RedirectMethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RedirectMethodEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public RedirectMethodEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RedirectMethodEnum.fromValue(value); + } + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/StirShaken.java b/src/main/java/com/bandwidth/sdk/model/StirShaken.java new file mode 100644 index 00000000..d6acdd08 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/StirShaken.java @@ -0,0 +1,347 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * StirShaken + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class StirShaken { + public static final String SERIALIZED_NAME_VERSTAT = "verstat"; + @SerializedName(SERIALIZED_NAME_VERSTAT) + private String verstat; + + public static final String SERIALIZED_NAME_ATTESTATION_INDICATOR = "attestationIndicator"; + @SerializedName(SERIALIZED_NAME_ATTESTATION_INDICATOR) + private String attestationIndicator; + + public static final String SERIALIZED_NAME_ORIGINATING_ID = "originatingId"; + @SerializedName(SERIALIZED_NAME_ORIGINATING_ID) + private String originatingId; + + public StirShaken() { + } + + public StirShaken verstat(String verstat) { + + this.verstat = verstat; + return this; + } + + /** + * (optional) The verification status indicating whether the verification was successful or not. Possible values are TN-Verification-Passed and TN-Verification-Failed. + * @return verstat + **/ + @javax.annotation.Nullable + public String getVerstat() { + return verstat; + } + + + public void setVerstat(String verstat) { + this.verstat = verstat; + } + + + public StirShaken attestationIndicator(String attestationIndicator) { + + this.attestationIndicator = attestationIndicator; + return this; + } + + /** + * (optional) The attestation level verified by Bandwidth. Possible values are A (full), B (partial) or C (gateway). + * @return attestationIndicator + **/ + @javax.annotation.Nullable + public String getAttestationIndicator() { + return attestationIndicator; + } + + + public void setAttestationIndicator(String attestationIndicator) { + this.attestationIndicator = attestationIndicator; + } + + + public StirShaken originatingId(String originatingId) { + + this.originatingId = originatingId; + return this; + } + + /** + * (optional) A unique origination identifier. + * @return originatingId + **/ + @javax.annotation.Nullable + public String getOriginatingId() { + return originatingId; + } + + + public void setOriginatingId(String originatingId) { + this.originatingId = originatingId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the StirShaken instance itself + */ + public StirShaken putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StirShaken stirShaken = (StirShaken) o; + return Objects.equals(this.verstat, stirShaken.verstat) && + Objects.equals(this.attestationIndicator, stirShaken.attestationIndicator) && + Objects.equals(this.originatingId, stirShaken.originatingId)&& + Objects.equals(this.additionalProperties, stirShaken.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(verstat, attestationIndicator, originatingId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StirShaken {\n"); + sb.append(" verstat: ").append(toIndentedString(verstat)).append("\n"); + sb.append(" attestationIndicator: ").append(toIndentedString(attestationIndicator)).append("\n"); + sb.append(" originatingId: ").append(toIndentedString(originatingId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("verstat"); + openapiFields.add("attestationIndicator"); + openapiFields.add("originatingId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StirShaken + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StirShaken.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StirShaken is not found in the empty JSON string", StirShaken.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("verstat") != null && !jsonObj.get("verstat").isJsonNull()) && !jsonObj.get("verstat").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `verstat` to be a primitive type in the JSON string but got `%s`", jsonObj.get("verstat").toString())); + } + if ((jsonObj.get("attestationIndicator") != null && !jsonObj.get("attestationIndicator").isJsonNull()) && !jsonObj.get("attestationIndicator").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `attestationIndicator` to be a primitive type in the JSON string but got `%s`", jsonObj.get("attestationIndicator").toString())); + } + if ((jsonObj.get("originatingId") != null && !jsonObj.get("originatingId").isJsonNull()) && !jsonObj.get("originatingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `originatingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("originatingId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StirShaken.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StirShaken' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StirShaken.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StirShaken value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public StirShaken read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + StirShaken instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of StirShaken given an JSON string + * + * @param jsonString JSON string + * @return An instance of StirShaken + * @throws IOException if the JSON string is invalid with respect to StirShaken + */ + public static StirShaken fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StirShaken.class); + } + + /** + * Convert an instance of StirShaken to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Tag.java b/src/main/java/com/bandwidth/sdk/model/Tag.java new file mode 100644 index 00000000..51ad488f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Tag.java @@ -0,0 +1,316 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Tag + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Tag { + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public Tag() { + } + + public Tag key(String key) { + + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + + public void setKey(String key) { + this.key = key; + } + + + public Tag value(String value) { + + this.value = value; + return this; + } + + /** + * Get value + * @return value + **/ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + + public void setValue(String value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Tag instance itself + */ + public Tag putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.key, tag.key) && + Objects.equals(this.value, tag.value)&& + Objects.equals(this.additionalProperties, tag.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Tag + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Tag.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Tag' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Tag value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Tag read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Tag instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Tag given an JSON string + * + * @param jsonString JSON string + * @return An instance of Tag + * @throws IOException if the JSON string is invalid with respect to Tag + */ + public static Tag fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Tag.class); + } + + /** + * Convert an instance of Tag to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java new file mode 100644 index 00000000..7b31b8b6 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TnLookupRequestError.java @@ -0,0 +1,285 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TnLookupRequestError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TnLookupRequestError { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + + public TnLookupRequestError() { + } + + public TnLookupRequestError message(String message) { + + this.message = message; + return this; + } + + /** + * A description of what validation error occurred. + * @return message + **/ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + + public void setMessage(String message) { + this.message = message; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TnLookupRequestError instance itself + */ + public TnLookupRequestError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TnLookupRequestError tnLookupRequestError = (TnLookupRequestError) o; + return Objects.equals(this.message, tnLookupRequestError.message)&& + Objects.equals(this.additionalProperties, tnLookupRequestError.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(message, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TnLookupRequestError {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TnLookupRequestError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TnLookupRequestError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TnLookupRequestError is not found in the empty JSON string", TnLookupRequestError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TnLookupRequestError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TnLookupRequestError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TnLookupRequestError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TnLookupRequestError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TnLookupRequestError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TnLookupRequestError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TnLookupRequestError given an JSON string + * + * @param jsonString JSON string + * @return An instance of TnLookupRequestError + * @throws IOException if the JSON string is invalid with respect to TnLookupRequestError + */ + public static TnLookupRequestError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TnLookupRequestError.class); + } + + /** + * Convert an instance of TnLookupRequestError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java new file mode 100644 index 00000000..d91cf36e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TranscribeRecording.java @@ -0,0 +1,478 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TranscribeRecording + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TranscribeRecording { + public static final String SERIALIZED_NAME_CALLBACK_URL = "callbackUrl"; + @SerializedName(SERIALIZED_NAME_CALLBACK_URL) + private URI callbackUrl; + + public static final String SERIALIZED_NAME_CALLBACK_METHOD = "callbackMethod"; + @SerializedName(SERIALIZED_NAME_CALLBACK_METHOD) + private CallbackMethodEnum callbackMethod = CallbackMethodEnum.POST; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_CALLBACK_TIMEOUT = "callbackTimeout"; + @SerializedName(SERIALIZED_NAME_CALLBACK_TIMEOUT) + private Double callbackTimeout = 15d; + + public static final String SERIALIZED_NAME_DETECT_LANGUAGE = "detectLanguage"; + @SerializedName(SERIALIZED_NAME_DETECT_LANGUAGE) + private Boolean detectLanguage = false; + + public TranscribeRecording() { + } + + public TranscribeRecording callbackUrl(URI callbackUrl) { + + this.callbackUrl = callbackUrl; + return this; + } + + /** + * The URL to send the [TranscriptionAvailable](/docs/voice/webhooks/transcriptionAvailable) event to. You should not include sensitive or personally-identifiable information in the callbackUrl field! Always use the proper username and password fields for authorization. + * @return callbackUrl + **/ + @javax.annotation.Nullable + public URI getCallbackUrl() { + return callbackUrl; + } + + + public void setCallbackUrl(URI callbackUrl) { + this.callbackUrl = callbackUrl; + } + + + public TranscribeRecording callbackMethod(CallbackMethodEnum callbackMethod) { + + this.callbackMethod = callbackMethod; + return this; + } + + /** + * Get callbackMethod + * @return callbackMethod + **/ + @javax.annotation.Nullable + public CallbackMethodEnum getCallbackMethod() { + return callbackMethod; + } + + + public void setCallbackMethod(CallbackMethodEnum callbackMethod) { + this.callbackMethod = callbackMethod; + } + + + public TranscribeRecording username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public TranscribeRecording password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public TranscribeRecording tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public TranscribeRecording callbackTimeout(Double callbackTimeout) { + + this.callbackTimeout = callbackTimeout; + return this; + } + + /** + * This is the timeout (in seconds) to use when delivering the webhook to `callbackUrl`. Can be any numeric value (including decimals) between 1 and 25. + * minimum: 1 + * maximum: 25 + * @return callbackTimeout + **/ + @javax.annotation.Nullable + public Double getCallbackTimeout() { + return callbackTimeout; + } + + + public void setCallbackTimeout(Double callbackTimeout) { + this.callbackTimeout = callbackTimeout; + } + + + public TranscribeRecording detectLanguage(Boolean detectLanguage) { + + this.detectLanguage = detectLanguage; + return this; + } + + /** + * A boolean value to indicate that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. + * @return detectLanguage + **/ + @javax.annotation.Nullable + public Boolean getDetectLanguage() { + return detectLanguage; + } + + + public void setDetectLanguage(Boolean detectLanguage) { + this.detectLanguage = detectLanguage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TranscribeRecording instance itself + */ + public TranscribeRecording putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranscribeRecording transcribeRecording = (TranscribeRecording) o; + return Objects.equals(this.callbackUrl, transcribeRecording.callbackUrl) && + Objects.equals(this.callbackMethod, transcribeRecording.callbackMethod) && + Objects.equals(this.username, transcribeRecording.username) && + Objects.equals(this.password, transcribeRecording.password) && + Objects.equals(this.tag, transcribeRecording.tag) && + Objects.equals(this.callbackTimeout, transcribeRecording.callbackTimeout) && + Objects.equals(this.detectLanguage, transcribeRecording.detectLanguage)&& + Objects.equals(this.additionalProperties, transcribeRecording.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(callbackUrl, callbackMethod, username, password, tag, callbackTimeout, detectLanguage, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranscribeRecording {\n"); + sb.append(" callbackUrl: ").append(toIndentedString(callbackUrl)).append("\n"); + sb.append(" callbackMethod: ").append(toIndentedString(callbackMethod)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" callbackTimeout: ").append(toIndentedString(callbackTimeout)).append("\n"); + sb.append(" detectLanguage: ").append(toIndentedString(detectLanguage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callbackUrl"); + openapiFields.add("callbackMethod"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("tag"); + openapiFields.add("callbackTimeout"); + openapiFields.add("detectLanguage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranscribeRecording + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranscribeRecording.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranscribeRecording is not found in the empty JSON string", TranscribeRecording.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callbackUrl") != null && !jsonObj.get("callbackUrl").isJsonNull()) && !jsonObj.get("callbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callbackUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranscribeRecording.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranscribeRecording' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranscribeRecording.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranscribeRecording value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TranscribeRecording read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TranscribeRecording instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranscribeRecording given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscribeRecording + * @throws IOException if the JSON string is invalid with respect to TranscribeRecording + */ + public static TranscribeRecording fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranscribeRecording.class); + } + + /** + * Convert an instance of TranscribeRecording to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/Transcription.java b/src/main/java/com/bandwidth/sdk/model/Transcription.java new file mode 100644 index 00000000..6f8759bd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -0,0 +1,313 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * Transcription + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class Transcription { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + private Double confidence; + + public Transcription() { + } + + public Transcription text(String text) { + + this.text = text; + return this; + } + + /** + * The transcribed text + * @return text + **/ + @javax.annotation.Nullable + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + + public Transcription confidence(Double confidence) { + + this.confidence = confidence; + return this; + } + + /** + * The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. + * @return confidence + **/ + @javax.annotation.Nullable + public Double getConfidence() { + return confidence; + } + + + public void setConfidence(Double confidence) { + this.confidence = confidence; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Transcription instance itself + */ + public Transcription putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Transcription transcription = (Transcription) o; + return Objects.equals(this.text, transcription.text) && + Objects.equals(this.confidence, transcription.confidence)&& + Objects.equals(this.additionalProperties, transcription.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(text, confidence, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Transcription {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + openapiFields.add("confidence"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Transcription + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Transcription.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Transcription is not found in the empty JSON string", Transcription.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Transcription.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Transcription' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Transcription.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Transcription value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Transcription read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Transcription instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Transcription given an JSON string + * + * @param jsonString JSON string + * @return An instance of Transcription + * @throws IOException if the JSON string is invalid with respect to Transcription + */ + public static Transcription fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Transcription.class); + } + + /** + * Convert an instance of Transcription to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java new file mode 100644 index 00000000..bfecfe6b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionAvailableCallback.java @@ -0,0 +1,905 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.bandwidth.sdk.model.Transcription; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * The Transcription Available event is sent when the recording transcription is available to be downloaded. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TranscriptionAvailableCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_MEDIA_URL = "mediaUrl"; + @SerializedName(SERIALIZED_NAME_MEDIA_URL) + private URI mediaUrl; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_RECORDING_ID = "recordingId"; + @SerializedName(SERIALIZED_NAME_RECORDING_ID) + private String recordingId; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_DURATION = "duration"; + @SerializedName(SERIALIZED_NAME_DURATION) + private String duration; + + public static final String SERIALIZED_NAME_FILE_FORMAT = "fileFormat"; + @SerializedName(SERIALIZED_NAME_FILE_FORMAT) + private FileFormatEnum fileFormat; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSCRIPTION = "transcription"; + @SerializedName(SERIALIZED_NAME_TRANSCRIPTION) + private Transcription transcription; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public TranscriptionAvailableCallback() { + } + + public TranscriptionAvailableCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public TranscriptionAvailableCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public TranscriptionAvailableCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public TranscriptionAvailableCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public TranscriptionAvailableCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public TranscriptionAvailableCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public TranscriptionAvailableCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public TranscriptionAvailableCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public TranscriptionAvailableCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public TranscriptionAvailableCallback mediaUrl(URI mediaUrl) { + + this.mediaUrl = mediaUrl; + return this; + } + + /** + * The URL that can be used to download the recording. Only present if the recording is finished and may be downloaded. + * @return mediaUrl + **/ + @javax.annotation.Nullable + public URI getMediaUrl() { + return mediaUrl; + } + + + public void setMediaUrl(URI mediaUrl) { + this.mediaUrl = mediaUrl; + } + + + public TranscriptionAvailableCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public TranscriptionAvailableCallback recordingId(String recordingId) { + + this.recordingId = recordingId; + return this; + } + + /** + * The unique ID of this recording + * @return recordingId + **/ + @javax.annotation.Nullable + public String getRecordingId() { + return recordingId; + } + + + public void setRecordingId(String recordingId) { + this.recordingId = recordingId; + } + + + public TranscriptionAvailableCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public TranscriptionAvailableCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public TranscriptionAvailableCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public TranscriptionAvailableCallback duration(String duration) { + + this.duration = duration; + return this; + } + + /** + * The duration of the recording in ISO-8601 format + * @return duration + **/ + @javax.annotation.Nullable + public String getDuration() { + return duration; + } + + + public void setDuration(String duration) { + this.duration = duration; + } + + + public TranscriptionAvailableCallback fileFormat(FileFormatEnum fileFormat) { + + this.fileFormat = fileFormat; + return this; + } + + /** + * Get fileFormat + * @return fileFormat + **/ + @javax.annotation.Nullable + public FileFormatEnum getFileFormat() { + return fileFormat; + } + + + public void setFileFormat(FileFormatEnum fileFormat) { + this.fileFormat = fileFormat; + } + + + public TranscriptionAvailableCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public TranscriptionAvailableCallback transcription(Transcription transcription) { + + this.transcription = transcription; + return this; + } + + /** + * Get transcription + * @return transcription + **/ + @javax.annotation.Nullable + public Transcription getTranscription() { + return transcription; + } + + + public void setTranscription(Transcription transcription) { + this.transcription = transcription; + } + + + public TranscriptionAvailableCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public TranscriptionAvailableCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TranscriptionAvailableCallback instance itself + */ + public TranscriptionAvailableCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranscriptionAvailableCallback transcriptionAvailableCallback = (TranscriptionAvailableCallback) o; + return Objects.equals(this.eventType, transcriptionAvailableCallback.eventType) && + Objects.equals(this.eventTime, transcriptionAvailableCallback.eventTime) && + Objects.equals(this.accountId, transcriptionAvailableCallback.accountId) && + Objects.equals(this.applicationId, transcriptionAvailableCallback.applicationId) && + Objects.equals(this.from, transcriptionAvailableCallback.from) && + Objects.equals(this.to, transcriptionAvailableCallback.to) && + Objects.equals(this.direction, transcriptionAvailableCallback.direction) && + Objects.equals(this.callId, transcriptionAvailableCallback.callId) && + Objects.equals(this.callUrl, transcriptionAvailableCallback.callUrl) && + Objects.equals(this.mediaUrl, transcriptionAvailableCallback.mediaUrl) && + Objects.equals(this.parentCallId, transcriptionAvailableCallback.parentCallId) && + Objects.equals(this.recordingId, transcriptionAvailableCallback.recordingId) && + Objects.equals(this.enqueuedTime, transcriptionAvailableCallback.enqueuedTime) && + Objects.equals(this.startTime, transcriptionAvailableCallback.startTime) && + Objects.equals(this.endTime, transcriptionAvailableCallback.endTime) && + Objects.equals(this.duration, transcriptionAvailableCallback.duration) && + Objects.equals(this.fileFormat, transcriptionAvailableCallback.fileFormat) && + Objects.equals(this.tag, transcriptionAvailableCallback.tag) && + Objects.equals(this.transcription, transcriptionAvailableCallback.transcription) && + Objects.equals(this.transferCallerId, transcriptionAvailableCallback.transferCallerId) && + Objects.equals(this.transferTo, transcriptionAvailableCallback.transferTo)&& + Objects.equals(this.additionalProperties, transcriptionAvailableCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, mediaUrl, parentCallId, recordingId, enqueuedTime, startTime, endTime, duration, fileFormat, tag, transcription, transferCallerId, transferTo, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranscriptionAvailableCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" mediaUrl: ").append(toIndentedString(mediaUrl)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" recordingId: ").append(toIndentedString(recordingId)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" duration: ").append(toIndentedString(duration)).append("\n"); + sb.append(" fileFormat: ").append(toIndentedString(fileFormat)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transcription: ").append(toIndentedString(transcription)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("mediaUrl"); + openapiFields.add("parentCallId"); + openapiFields.add("recordingId"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("endTime"); + openapiFields.add("duration"); + openapiFields.add("fileFormat"); + openapiFields.add("tag"); + openapiFields.add("transcription"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranscriptionAvailableCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranscriptionAvailableCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranscriptionAvailableCallback is not found in the empty JSON string", TranscriptionAvailableCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("mediaUrl") != null && !jsonObj.get("mediaUrl").isJsonNull()) && !jsonObj.get("mediaUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mediaUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mediaUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("recordingId") != null && !jsonObj.get("recordingId").isJsonNull()) && !jsonObj.get("recordingId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `recordingId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("recordingId").toString())); + } + if ((jsonObj.get("duration") != null && !jsonObj.get("duration").isJsonNull()) && !jsonObj.get("duration").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `duration` to be a primitive type in the JSON string but got `%s`", jsonObj.get("duration").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + // validate the optional field `transcription` + if (jsonObj.get("transcription") != null && !jsonObj.get("transcription").isJsonNull()) { + Transcription.validateJsonElement(jsonObj.get("transcription")); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranscriptionAvailableCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranscriptionAvailableCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranscriptionAvailableCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranscriptionAvailableCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TranscriptionAvailableCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TranscriptionAvailableCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranscriptionAvailableCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscriptionAvailableCallback + * @throws IOException if the JSON string is invalid with respect to TranscriptionAvailableCallback + */ + public static TranscriptionAvailableCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranscriptionAvailableCallback.class); + } + + /** + * Convert an instance of TranscriptionAvailableCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java new file mode 100644 index 00000000..ba4f6681 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionList.java @@ -0,0 +1,307 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.Transcription; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * TranscriptionList + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TranscriptionList { + public static final String SERIALIZED_NAME_TRANSCRIPTS = "transcripts"; + @SerializedName(SERIALIZED_NAME_TRANSCRIPTS) + private List transcripts; + + public TranscriptionList() { + } + + public TranscriptionList transcripts(List transcripts) { + + this.transcripts = transcripts; + return this; + } + + public TranscriptionList addTranscriptsItem(Transcription transcriptsItem) { + if (this.transcripts == null) { + this.transcripts = new ArrayList<>(); + } + this.transcripts.add(transcriptsItem); + return this; + } + + /** + * Get transcripts + * @return transcripts + **/ + @javax.annotation.Nullable + public List getTranscripts() { + return transcripts; + } + + + public void setTranscripts(List transcripts) { + this.transcripts = transcripts; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TranscriptionList instance itself + */ + public TranscriptionList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranscriptionList transcriptionList = (TranscriptionList) o; + return Objects.equals(this.transcripts, transcriptionList.transcripts)&& + Objects.equals(this.additionalProperties, transcriptionList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(transcripts, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranscriptionList {\n"); + sb.append(" transcripts: ").append(toIndentedString(transcripts)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transcripts"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranscriptionList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranscriptionList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranscriptionList is not found in the empty JSON string", TranscriptionList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("transcripts") != null && !jsonObj.get("transcripts").isJsonNull()) { + JsonArray jsonArraytranscripts = jsonObj.getAsJsonArray("transcripts"); + if (jsonArraytranscripts != null) { + // ensure the json data is an array + if (!jsonObj.get("transcripts").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `transcripts` to be an array in the JSON string but got `%s`", jsonObj.get("transcripts").toString())); + } + + // validate the optional field `transcripts` (array) + for (int i = 0; i < jsonArraytranscripts.size(); i++) { + Transcription.validateJsonElement(jsonArraytranscripts.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranscriptionList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranscriptionList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranscriptionList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranscriptionList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TranscriptionList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TranscriptionList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranscriptionList given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscriptionList + * @throws IOException if the JSON string is invalid with respect to TranscriptionList + */ + public static TranscriptionList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranscriptionList.class); + } + + /** + * Convert an instance of TranscriptionList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java new file mode 100644 index 00000000..cdbe2d89 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TranscriptionMetadata.java @@ -0,0 +1,379 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * If the recording was transcribed, metadata about the transcription + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TranscriptionMetadata { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public static final String SERIALIZED_NAME_COMPLETED_TIME = "completedTime"; + @SerializedName(SERIALIZED_NAME_COMPLETED_TIME) + private String completedTime; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private URI url; + + public TranscriptionMetadata() { + } + + public TranscriptionMetadata id(String id) { + + this.id = id; + return this; + } + + /** + * The unique transcription ID + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public TranscriptionMetadata status(String status) { + + this.status = status; + return this; + } + + /** + * The current status of the process. For recording, current possible values are 'processing', 'partial', 'complete', 'deleted', and 'error'. For transcriptions, current possible values are 'none', 'processing', 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional states may be added in the future, so your application must be tolerant of unknown values. + * @return status + **/ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + + public void setStatus(String status) { + this.status = status; + } + + + public TranscriptionMetadata completedTime(String completedTime) { + + this.completedTime = completedTime; + return this; + } + + /** + * The time that the transcription was completed + * @return completedTime + **/ + @javax.annotation.Nullable + public String getCompletedTime() { + return completedTime; + } + + + public void setCompletedTime(String completedTime) { + this.completedTime = completedTime; + } + + + public TranscriptionMetadata url(URI url) { + + this.url = url; + return this; + } + + /** + * The URL of the [transcription](#operation/getCallTranscription) + * @return url + **/ + @javax.annotation.Nullable + public URI getUrl() { + return url; + } + + + public void setUrl(URI url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TranscriptionMetadata instance itself + */ + public TranscriptionMetadata putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranscriptionMetadata transcriptionMetadata = (TranscriptionMetadata) o; + return Objects.equals(this.id, transcriptionMetadata.id) && + Objects.equals(this.status, transcriptionMetadata.status) && + Objects.equals(this.completedTime, transcriptionMetadata.completedTime) && + Objects.equals(this.url, transcriptionMetadata.url)&& + Objects.equals(this.additionalProperties, transcriptionMetadata.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, completedTime, url, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranscriptionMetadata {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" completedTime: ").append(toIndentedString(completedTime)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("id"); + openapiFields.add("status"); + openapiFields.add("completedTime"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranscriptionMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranscriptionMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranscriptionMetadata is not found in the empty JSON string", TranscriptionMetadata.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + if ((jsonObj.get("completedTime") != null && !jsonObj.get("completedTime").isJsonNull()) && !jsonObj.get("completedTime").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `completedTime` to be a primitive type in the JSON string but got `%s`", jsonObj.get("completedTime").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranscriptionMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranscriptionMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranscriptionMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranscriptionMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TranscriptionMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TranscriptionMetadata instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranscriptionMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranscriptionMetadata + * @throws IOException if the JSON string is invalid with respect to TranscriptionMetadata + */ + public static TranscriptionMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranscriptionMetadata.class); + } + + /** + * Convert an instance of TranscriptionMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java new file mode 100644 index 00000000..f93587f5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TransferAnswerCallback.java @@ -0,0 +1,718 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * When processing a <Transfer> verb, this event is sent when a called party (B-leg) answers. The event is sent to the endpoint specified in the transferAnswerUrl attribute of the <PhoneNumber> tag that answered. BXML returned by this callback will be executed for the called party only. After all BXML has been executed, the called party will be bridged to the original call. Most BXML verbs are allowed in response to a transferAnswer event, but some are not allowed. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TransferAnswerCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public TransferAnswerCallback() { + } + + public TransferAnswerCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public TransferAnswerCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public TransferAnswerCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public TransferAnswerCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public TransferAnswerCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public TransferAnswerCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public TransferAnswerCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public TransferAnswerCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public TransferAnswerCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public TransferAnswerCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public TransferAnswerCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public TransferAnswerCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public TransferAnswerCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public TransferAnswerCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public TransferAnswerCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TransferAnswerCallback instance itself + */ + public TransferAnswerCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransferAnswerCallback transferAnswerCallback = (TransferAnswerCallback) o; + return Objects.equals(this.eventType, transferAnswerCallback.eventType) && + Objects.equals(this.eventTime, transferAnswerCallback.eventTime) && + Objects.equals(this.accountId, transferAnswerCallback.accountId) && + Objects.equals(this.applicationId, transferAnswerCallback.applicationId) && + Objects.equals(this.from, transferAnswerCallback.from) && + Objects.equals(this.to, transferAnswerCallback.to) && + Objects.equals(this.direction, transferAnswerCallback.direction) && + Objects.equals(this.callId, transferAnswerCallback.callId) && + Objects.equals(this.callUrl, transferAnswerCallback.callUrl) && + Objects.equals(this.enqueuedTime, transferAnswerCallback.enqueuedTime) && + Objects.equals(this.startTime, transferAnswerCallback.startTime) && + Objects.equals(this.answerTime, transferAnswerCallback.answerTime) && + Objects.equals(this.tag, transferAnswerCallback.tag) && + Objects.equals(this.transferCallerId, transferAnswerCallback.transferCallerId) && + Objects.equals(this.transferTo, transferAnswerCallback.transferTo)&& + Objects.equals(this.additionalProperties, transferAnswerCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, transferCallerId, transferTo, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransferAnswerCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransferAnswerCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransferAnswerCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransferAnswerCallback is not found in the empty JSON string", TransferAnswerCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransferAnswerCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransferAnswerCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransferAnswerCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransferAnswerCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TransferAnswerCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TransferAnswerCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransferAnswerCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferAnswerCallback + * @throws IOException if the JSON string is invalid with respect to TransferAnswerCallback + */ + public static TransferAnswerCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransferAnswerCallback.class); + } + + /** + * Convert an instance of TransferAnswerCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java new file mode 100644 index 00000000..6b6ef181 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TransferCompleteCallback.java @@ -0,0 +1,811 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * This event is sent to the transferCompleteUrl of the A-leg's <Transfer> verb when the transferred call (B-leg) completes. In a simultaneous ringing scenario, only one B-leg succeeds and this event corresponds to that successful leg. If none of the calls were answered, the transferComplete event corresponds to one of the legs. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TransferCompleteCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public static final String SERIALIZED_NAME_CAUSE = "cause"; + @SerializedName(SERIALIZED_NAME_CAUSE) + private String cause; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_ERROR_ID = "errorId"; + @SerializedName(SERIALIZED_NAME_ERROR_ID) + private String errorId; + + public TransferCompleteCallback() { + } + + public TransferCompleteCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public TransferCompleteCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public TransferCompleteCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public TransferCompleteCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public TransferCompleteCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public TransferCompleteCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public TransferCompleteCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public TransferCompleteCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public TransferCompleteCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public TransferCompleteCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public TransferCompleteCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public TransferCompleteCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public TransferCompleteCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public TransferCompleteCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public TransferCompleteCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + + public TransferCompleteCallback cause(String cause) { + + this.cause = cause; + return this; + } + + /** + * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * @return cause + **/ + @javax.annotation.Nullable + public String getCause() { + return cause; + } + + + public void setCause(String cause) { + this.cause = cause; + } + + + public TransferCompleteCallback errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * Text explaining the reason that caused the call to fail in case of errors. + * @return errorMessage + **/ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + public TransferCompleteCallback errorId(String errorId) { + + this.errorId = errorId; + return this; + } + + /** + * Bandwidth's internal id that references the error event. + * @return errorId + **/ + @javax.annotation.Nullable + public String getErrorId() { + return errorId; + } + + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TransferCompleteCallback instance itself + */ + public TransferCompleteCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransferCompleteCallback transferCompleteCallback = (TransferCompleteCallback) o; + return Objects.equals(this.eventType, transferCompleteCallback.eventType) && + Objects.equals(this.eventTime, transferCompleteCallback.eventTime) && + Objects.equals(this.accountId, transferCompleteCallback.accountId) && + Objects.equals(this.applicationId, transferCompleteCallback.applicationId) && + Objects.equals(this.from, transferCompleteCallback.from) && + Objects.equals(this.to, transferCompleteCallback.to) && + Objects.equals(this.direction, transferCompleteCallback.direction) && + Objects.equals(this.callId, transferCompleteCallback.callId) && + Objects.equals(this.callUrl, transferCompleteCallback.callUrl) && + Objects.equals(this.enqueuedTime, transferCompleteCallback.enqueuedTime) && + Objects.equals(this.startTime, transferCompleteCallback.startTime) && + Objects.equals(this.answerTime, transferCompleteCallback.answerTime) && + Objects.equals(this.tag, transferCompleteCallback.tag) && + Objects.equals(this.transferCallerId, transferCompleteCallback.transferCallerId) && + Objects.equals(this.transferTo, transferCompleteCallback.transferTo) && + Objects.equals(this.cause, transferCompleteCallback.cause) && + Objects.equals(this.errorMessage, transferCompleteCallback.errorMessage) && + Objects.equals(this.errorId, transferCompleteCallback.errorId)&& + Objects.equals(this.additionalProperties, transferCompleteCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, enqueuedTime, startTime, answerTime, tag, transferCallerId, transferTo, cause, errorMessage, errorId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransferCompleteCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" cause: ").append(toIndentedString(cause)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorId: ").append(toIndentedString(errorId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("tag"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + openapiFields.add("cause"); + openapiFields.add("errorMessage"); + openapiFields.add("errorId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransferCompleteCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransferCompleteCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransferCompleteCallback is not found in the empty JSON string", TransferCompleteCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + if ((jsonObj.get("cause") != null && !jsonObj.get("cause").isJsonNull()) && !jsonObj.get("cause").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cause` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cause").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("errorId") != null && !jsonObj.get("errorId").isJsonNull()) && !jsonObj.get("errorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransferCompleteCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransferCompleteCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransferCompleteCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransferCompleteCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TransferCompleteCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TransferCompleteCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransferCompleteCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferCompleteCallback + * @throws IOException if the JSON string is invalid with respect to TransferCompleteCallback + */ + public static TransferCompleteCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransferCompleteCallback.class); + } + + /** + * Convert an instance of TransferCompleteCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java new file mode 100644 index 00000000..a7b267eb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/TransferDisconnectCallback.java @@ -0,0 +1,870 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * This event is sent to the transferDisconnectUrl of each <PhoneNumber> tag when its respective call leg ends for any reason. The event is sent in the normal case, when the transferred leg is answered and later hung up, but is also sent if the new leg was never answered in the first place, if it was rejected, and if the original call leg hung up before the transferred leg. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class TransferDisconnectCallback { + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + + public static final String SERIALIZED_NAME_EVENT_TIME = "eventTime"; + @SerializedName(SERIALIZED_NAME_EVENT_TIME) + private OffsetDateTime eventTime; + + public static final String SERIALIZED_NAME_ACCOUNT_ID = "accountId"; + @SerializedName(SERIALIZED_NAME_ACCOUNT_ID) + private String accountId; + + public static final String SERIALIZED_NAME_APPLICATION_ID = "applicationId"; + @SerializedName(SERIALIZED_NAME_APPLICATION_ID) + private String applicationId; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_DIRECTION = "direction"; + @SerializedName(SERIALIZED_NAME_DIRECTION) + private CallDirectionEnum direction; + + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public static final String SERIALIZED_NAME_CALL_URL = "callUrl"; + @SerializedName(SERIALIZED_NAME_CALL_URL) + private String callUrl; + + public static final String SERIALIZED_NAME_PARENT_CALL_ID = "parentCallId"; + @SerializedName(SERIALIZED_NAME_PARENT_CALL_ID) + private String parentCallId; + + public static final String SERIALIZED_NAME_ENQUEUED_TIME = "enqueuedTime"; + @SerializedName(SERIALIZED_NAME_ENQUEUED_TIME) + private OffsetDateTime enqueuedTime; + + public static final String SERIALIZED_NAME_START_TIME = "startTime"; + @SerializedName(SERIALIZED_NAME_START_TIME) + private OffsetDateTime startTime; + + public static final String SERIALIZED_NAME_ANSWER_TIME = "answerTime"; + @SerializedName(SERIALIZED_NAME_ANSWER_TIME) + private OffsetDateTime answerTime; + + public static final String SERIALIZED_NAME_END_TIME = "endTime"; + @SerializedName(SERIALIZED_NAME_END_TIME) + private OffsetDateTime endTime; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public static final String SERIALIZED_NAME_TRANSFER_CALLER_ID = "transferCallerId"; + @SerializedName(SERIALIZED_NAME_TRANSFER_CALLER_ID) + private String transferCallerId; + + public static final String SERIALIZED_NAME_TRANSFER_TO = "transferTo"; + @SerializedName(SERIALIZED_NAME_TRANSFER_TO) + private String transferTo; + + public static final String SERIALIZED_NAME_CAUSE = "cause"; + @SerializedName(SERIALIZED_NAME_CAUSE) + private String cause; + + public static final String SERIALIZED_NAME_ERROR_MESSAGE = "errorMessage"; + @SerializedName(SERIALIZED_NAME_ERROR_MESSAGE) + private String errorMessage; + + public static final String SERIALIZED_NAME_ERROR_ID = "errorId"; + @SerializedName(SERIALIZED_NAME_ERROR_ID) + private String errorId; + + public TransferDisconnectCallback() { + } + + public TransferDisconnectCallback eventType(String eventType) { + + this.eventType = eventType; + return this; + } + + /** + * The event type, value can be one of the following: answer, bridgeComplete, bridgeTargetComplete, conferenceCreated, conferenceRedirect, conferenceMemberJoin, conferenceMemberExit, conferenceCompleted, conferenceRecordingAvailable, disconnect, dtmf, gather, initiate, machineDetectionComplete, recordingComplete, recordingAvailable, redirect, transcriptionAvailable, transferAnswer, transferComplete, transferDisconnect. + * @return eventType + **/ + @javax.annotation.Nullable + public String getEventType() { + return eventType; + } + + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + + public TransferDisconnectCallback eventTime(OffsetDateTime eventTime) { + + this.eventTime = eventTime; + return this; + } + + /** + * The approximate UTC date and time when the event was generated by the Bandwidth server, in ISO 8601 format. This may not be exactly the time of event execution. + * @return eventTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEventTime() { + return eventTime; + } + + + public void setEventTime(OffsetDateTime eventTime) { + this.eventTime = eventTime; + } + + + public TransferDisconnectCallback accountId(String accountId) { + + this.accountId = accountId; + return this; + } + + /** + * The user account associated with the call. + * @return accountId + **/ + @javax.annotation.Nullable + public String getAccountId() { + return accountId; + } + + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + + public TransferDisconnectCallback applicationId(String applicationId) { + + this.applicationId = applicationId; + return this; + } + + /** + * The id of the application associated with the call. + * @return applicationId + **/ + @javax.annotation.Nullable + public String getApplicationId() { + return applicationId; + } + + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + + public TransferDisconnectCallback from(String from) { + + this.from = from; + return this; + } + + /** + * The provided identifier of the caller: can be a phone number in E.164 format (e.g. +15555555555) or one of Private, Restricted, Unavailable, or Anonymous. + * @return from + **/ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + + public void setFrom(String from) { + this.from = from; + } + + + public TransferDisconnectCallback to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number that received the call, in E.164 format (e.g. +15555555555). + * @return to + **/ + @javax.annotation.Nullable + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public TransferDisconnectCallback direction(CallDirectionEnum direction) { + + this.direction = direction; + return this; + } + + /** + * Get direction + * @return direction + **/ + @javax.annotation.Nullable + public CallDirectionEnum getDirection() { + return direction; + } + + + public void setDirection(CallDirectionEnum direction) { + this.direction = direction; + } + + + public TransferDisconnectCallback callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * The call id associated with the event. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + + public TransferDisconnectCallback callUrl(String callUrl) { + + this.callUrl = callUrl; + return this; + } + + /** + * The URL of the call associated with the event. + * @return callUrl + **/ + @javax.annotation.Nullable + public String getCallUrl() { + return callUrl; + } + + + public void setCallUrl(String callUrl) { + this.callUrl = callUrl; + } + + + public TransferDisconnectCallback parentCallId(String parentCallId) { + + this.parentCallId = parentCallId; + return this; + } + + /** + * (optional) If the event is related to the B leg of a <Transfer>, the call id of the original call leg that executed the <Transfer>. Otherwise, this field will not be present. + * @return parentCallId + **/ + @javax.annotation.Nullable + public String getParentCallId() { + return parentCallId; + } + + + public void setParentCallId(String parentCallId) { + this.parentCallId = parentCallId; + } + + + public TransferDisconnectCallback enqueuedTime(OffsetDateTime enqueuedTime) { + + this.enqueuedTime = enqueuedTime; + return this; + } + + /** + * (optional) If call queueing is enabled and this is an outbound call, time the call was queued, in ISO 8601 format. + * @return enqueuedTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEnqueuedTime() { + return enqueuedTime; + } + + + public void setEnqueuedTime(OffsetDateTime enqueuedTime) { + this.enqueuedTime = enqueuedTime; + } + + + public TransferDisconnectCallback startTime(OffsetDateTime startTime) { + + this.startTime = startTime; + return this; + } + + /** + * Time the call was started, in ISO 8601 format. + * @return startTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getStartTime() { + return startTime; + } + + + public void setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + } + + + public TransferDisconnectCallback answerTime(OffsetDateTime answerTime) { + + this.answerTime = answerTime; + return this; + } + + /** + * Time the call was answered, in ISO 8601 format. + * @return answerTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getAnswerTime() { + return answerTime; + } + + + public void setAnswerTime(OffsetDateTime answerTime) { + this.answerTime = answerTime; + } + + + public TransferDisconnectCallback endTime(OffsetDateTime endTime) { + + this.endTime = endTime; + return this; + } + + /** + * The time that the recording ended in ISO-8601 format + * @return endTime + **/ + @javax.annotation.Nullable + public OffsetDateTime getEndTime() { + return endTime; + } + + + public void setEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + } + + + public TransferDisconnectCallback tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * (optional) The tag specified on call creation. If no tag was specified or it was previously cleared, this field will not be present. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + + public TransferDisconnectCallback transferCallerId(String transferCallerId) { + + this.transferCallerId = transferCallerId; + return this; + } + + /** + * The phone number used as the from field of the B-leg call, in E.164 format (e.g. +15555555555) or one of Restricted, Anonymous, Private, or Unavailable. + * @return transferCallerId + **/ + @javax.annotation.Nullable + public String getTransferCallerId() { + return transferCallerId; + } + + + public void setTransferCallerId(String transferCallerId) { + this.transferCallerId = transferCallerId; + } + + + public TransferDisconnectCallback transferTo(String transferTo) { + + this.transferTo = transferTo; + return this; + } + + /** + * The phone number used as the to field of the B-leg call, in E.164 format (e.g. +15555555555). + * @return transferTo + **/ + @javax.annotation.Nullable + public String getTransferTo() { + return transferTo; + } + + + public void setTransferTo(String transferTo) { + this.transferTo = transferTo; + } + + + public TransferDisconnectCallback cause(String cause) { + + this.cause = cause; + return this; + } + + /** + * Reason the call failed - hangup, busy, timeout, cancel, rejected, callback-error, invalid-bxml, application-error, account-limit, node-capacity-exceeded, error, or unknown. + * @return cause + **/ + @javax.annotation.Nullable + public String getCause() { + return cause; + } + + + public void setCause(String cause) { + this.cause = cause; + } + + + public TransferDisconnectCallback errorMessage(String errorMessage) { + + this.errorMessage = errorMessage; + return this; + } + + /** + * Text explaining the reason that caused the call to fail in case of errors. + * @return errorMessage + **/ + @javax.annotation.Nullable + public String getErrorMessage() { + return errorMessage; + } + + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + + public TransferDisconnectCallback errorId(String errorId) { + + this.errorId = errorId; + return this; + } + + /** + * Bandwidth's internal id that references the error event. + * @return errorId + **/ + @javax.annotation.Nullable + public String getErrorId() { + return errorId; + } + + + public void setErrorId(String errorId) { + this.errorId = errorId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TransferDisconnectCallback instance itself + */ + public TransferDisconnectCallback putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransferDisconnectCallback transferDisconnectCallback = (TransferDisconnectCallback) o; + return Objects.equals(this.eventType, transferDisconnectCallback.eventType) && + Objects.equals(this.eventTime, transferDisconnectCallback.eventTime) && + Objects.equals(this.accountId, transferDisconnectCallback.accountId) && + Objects.equals(this.applicationId, transferDisconnectCallback.applicationId) && + Objects.equals(this.from, transferDisconnectCallback.from) && + Objects.equals(this.to, transferDisconnectCallback.to) && + Objects.equals(this.direction, transferDisconnectCallback.direction) && + Objects.equals(this.callId, transferDisconnectCallback.callId) && + Objects.equals(this.callUrl, transferDisconnectCallback.callUrl) && + Objects.equals(this.parentCallId, transferDisconnectCallback.parentCallId) && + Objects.equals(this.enqueuedTime, transferDisconnectCallback.enqueuedTime) && + Objects.equals(this.startTime, transferDisconnectCallback.startTime) && + Objects.equals(this.answerTime, transferDisconnectCallback.answerTime) && + Objects.equals(this.endTime, transferDisconnectCallback.endTime) && + Objects.equals(this.tag, transferDisconnectCallback.tag) && + Objects.equals(this.transferCallerId, transferDisconnectCallback.transferCallerId) && + Objects.equals(this.transferTo, transferDisconnectCallback.transferTo) && + Objects.equals(this.cause, transferDisconnectCallback.cause) && + Objects.equals(this.errorMessage, transferDisconnectCallback.errorMessage) && + Objects.equals(this.errorId, transferDisconnectCallback.errorId)&& + Objects.equals(this.additionalProperties, transferDisconnectCallback.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(eventType, eventTime, accountId, applicationId, from, to, direction, callId, callUrl, parentCallId, enqueuedTime, startTime, answerTime, endTime, tag, transferCallerId, transferTo, cause, errorMessage, errorId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TransferDisconnectCallback {\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" eventTime: ").append(toIndentedString(eventTime)).append("\n"); + sb.append(" accountId: ").append(toIndentedString(accountId)).append("\n"); + sb.append(" applicationId: ").append(toIndentedString(applicationId)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" direction: ").append(toIndentedString(direction)).append("\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" callUrl: ").append(toIndentedString(callUrl)).append("\n"); + sb.append(" parentCallId: ").append(toIndentedString(parentCallId)).append("\n"); + sb.append(" enqueuedTime: ").append(toIndentedString(enqueuedTime)).append("\n"); + sb.append(" startTime: ").append(toIndentedString(startTime)).append("\n"); + sb.append(" answerTime: ").append(toIndentedString(answerTime)).append("\n"); + sb.append(" endTime: ").append(toIndentedString(endTime)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" transferCallerId: ").append(toIndentedString(transferCallerId)).append("\n"); + sb.append(" transferTo: ").append(toIndentedString(transferTo)).append("\n"); + sb.append(" cause: ").append(toIndentedString(cause)).append("\n"); + sb.append(" errorMessage: ").append(toIndentedString(errorMessage)).append("\n"); + sb.append(" errorId: ").append(toIndentedString(errorId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventType"); + openapiFields.add("eventTime"); + openapiFields.add("accountId"); + openapiFields.add("applicationId"); + openapiFields.add("from"); + openapiFields.add("to"); + openapiFields.add("direction"); + openapiFields.add("callId"); + openapiFields.add("callUrl"); + openapiFields.add("parentCallId"); + openapiFields.add("enqueuedTime"); + openapiFields.add("startTime"); + openapiFields.add("answerTime"); + openapiFields.add("endTime"); + openapiFields.add("tag"); + openapiFields.add("transferCallerId"); + openapiFields.add("transferTo"); + openapiFields.add("cause"); + openapiFields.add("errorMessage"); + openapiFields.add("errorId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TransferDisconnectCallback + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransferDisconnectCallback.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransferDisconnectCallback is not found in the empty JSON string", TransferDisconnectCallback.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("eventType") != null && !jsonObj.get("eventType").isJsonNull()) && !jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if ((jsonObj.get("accountId") != null && !jsonObj.get("accountId").isJsonNull()) && !jsonObj.get("accountId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `accountId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountId").toString())); + } + if ((jsonObj.get("applicationId") != null && !jsonObj.get("applicationId").isJsonNull()) && !jsonObj.get("applicationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `applicationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("applicationId").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + if ((jsonObj.get("to") != null && !jsonObj.get("to").isJsonNull()) && !jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + if ((jsonObj.get("callUrl") != null && !jsonObj.get("callUrl").isJsonNull()) && !jsonObj.get("callUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callUrl").toString())); + } + if ((jsonObj.get("parentCallId") != null && !jsonObj.get("parentCallId").isJsonNull()) && !jsonObj.get("parentCallId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentCallId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentCallId").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + if ((jsonObj.get("transferCallerId") != null && !jsonObj.get("transferCallerId").isJsonNull()) && !jsonObj.get("transferCallerId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferCallerId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferCallerId").toString())); + } + if ((jsonObj.get("transferTo") != null && !jsonObj.get("transferTo").isJsonNull()) && !jsonObj.get("transferTo").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `transferTo` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transferTo").toString())); + } + if ((jsonObj.get("cause") != null && !jsonObj.get("cause").isJsonNull()) && !jsonObj.get("cause").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cause` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cause").toString())); + } + if ((jsonObj.get("errorMessage") != null && !jsonObj.get("errorMessage").isJsonNull()) && !jsonObj.get("errorMessage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorMessage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorMessage").toString())); + } + if ((jsonObj.get("errorId") != null && !jsonObj.get("errorId").isJsonNull()) && !jsonObj.get("errorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransferDisconnectCallback.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransferDisconnectCallback' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransferDisconnectCallback.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransferDisconnectCallback value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TransferDisconnectCallback read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TransferDisconnectCallback instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransferDisconnectCallback given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferDisconnectCallback + * @throws IOException if the JSON string is invalid with respect to TransferDisconnectCallback + */ + public static TransferDisconnectCallback fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransferDisconnectCallback.class); + } + + /** + * Convert an instance of TransferDisconnectCallback to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCall.java b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java new file mode 100644 index 00000000..12bcf063 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCall.java @@ -0,0 +1,570 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.CallStateEnum; +import com.bandwidth.sdk.model.RedirectMethodEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * UpdateCall + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class UpdateCall { + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private CallStateEnum state = CallStateEnum.ACTIVE; + + public static final String SERIALIZED_NAME_REDIRECT_URL = "redirectUrl"; + @SerializedName(SERIALIZED_NAME_REDIRECT_URL) + private URI redirectUrl; + + public static final String SERIALIZED_NAME_REDIRECT_METHOD = "redirectMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_METHOD) + private RedirectMethodEnum redirectMethod = RedirectMethodEnum.POST; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_REDIRECT_FALLBACK_URL = "redirectFallbackUrl"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FALLBACK_URL) + private URI redirectFallbackUrl; + + public static final String SERIALIZED_NAME_REDIRECT_FALLBACK_METHOD = "redirectFallbackMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FALLBACK_METHOD) + private RedirectMethodEnum redirectFallbackMethod = RedirectMethodEnum.POST; + + public static final String SERIALIZED_NAME_FALLBACK_USERNAME = "fallbackUsername"; + @SerializedName(SERIALIZED_NAME_FALLBACK_USERNAME) + private String fallbackUsername; + + public static final String SERIALIZED_NAME_FALLBACK_PASSWORD = "fallbackPassword"; + @SerializedName(SERIALIZED_NAME_FALLBACK_PASSWORD) + private String fallbackPassword; + + public static final String SERIALIZED_NAME_TAG = "tag"; + @SerializedName(SERIALIZED_NAME_TAG) + private String tag; + + public UpdateCall() { + } + + public UpdateCall state(CallStateEnum state) { + + this.state = state; + return this; + } + + /** + * Get state + * @return state + **/ + @javax.annotation.Nullable + public CallStateEnum getState() { + return state; + } + + + public void setState(CallStateEnum state) { + this.state = state; + } + + + public UpdateCall redirectUrl(URI redirectUrl) { + + this.redirectUrl = redirectUrl; + return this; + } + + /** + * The URL to send the [Redirect](/docs/voice/bxml/redirect) event to which will provide new BXML. Required if `state` is `active`. Not allowed if `state` is `completed`. + * @return redirectUrl + **/ + @javax.annotation.Nullable + public URI getRedirectUrl() { + return redirectUrl; + } + + + public void setRedirectUrl(URI redirectUrl) { + this.redirectUrl = redirectUrl; + } + + + public UpdateCall redirectMethod(RedirectMethodEnum redirectMethod) { + + this.redirectMethod = redirectMethod; + return this; + } + + /** + * Get redirectMethod + * @return redirectMethod + **/ + @javax.annotation.Nullable + public RedirectMethodEnum getRedirectMethod() { + return redirectMethod; + } + + + public void setRedirectMethod(RedirectMethodEnum redirectMethod) { + this.redirectMethod = redirectMethod; + } + + + public UpdateCall username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public UpdateCall password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public UpdateCall redirectFallbackUrl(URI redirectFallbackUrl) { + + this.redirectFallbackUrl = redirectFallbackUrl; + return this; + } + + /** + * A fallback url which, if provided, will be used to retry the redirect callback delivery in case `redirectUrl` fails to respond. + * @return redirectFallbackUrl + **/ + @javax.annotation.Nullable + public URI getRedirectFallbackUrl() { + return redirectFallbackUrl; + } + + + public void setRedirectFallbackUrl(URI redirectFallbackUrl) { + this.redirectFallbackUrl = redirectFallbackUrl; + } + + + public UpdateCall redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + + this.redirectFallbackMethod = redirectFallbackMethod; + return this; + } + + /** + * Get redirectFallbackMethod + * @return redirectFallbackMethod + **/ + @javax.annotation.Nullable + public RedirectMethodEnum getRedirectFallbackMethod() { + return redirectFallbackMethod; + } + + + public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + this.redirectFallbackMethod = redirectFallbackMethod; + } + + + public UpdateCall fallbackUsername(String fallbackUsername) { + + this.fallbackUsername = fallbackUsername; + return this; + } + + /** + * Basic auth username. + * @return fallbackUsername + **/ + @javax.annotation.Nullable + public String getFallbackUsername() { + return fallbackUsername; + } + + + public void setFallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; + } + + + public UpdateCall fallbackPassword(String fallbackPassword) { + + this.fallbackPassword = fallbackPassword; + return this; + } + + /** + * Basic auth password. + * @return fallbackPassword + **/ + @javax.annotation.Nullable + public String getFallbackPassword() { + return fallbackPassword; + } + + + public void setFallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; + } + + + public UpdateCall tag(String tag) { + + this.tag = tag; + return this; + } + + /** + * A custom string that will be sent with this and all future callbacks unless overwritten by a future `tag` attribute or [`<Tag>`](/docs/voice/bxml/tag) verb, or cleared. May be cleared by setting `tag=\"\"`. Max length 256 characters. Not allowed if `state` is `completed`. + * @return tag + **/ + @javax.annotation.Nullable + public String getTag() { + return tag; + } + + + public void setTag(String tag) { + this.tag = tag; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateCall instance itself + */ + public UpdateCall putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCall updateCall = (UpdateCall) o; + return Objects.equals(this.state, updateCall.state) && + Objects.equals(this.redirectUrl, updateCall.redirectUrl) && + Objects.equals(this.redirectMethod, updateCall.redirectMethod) && + Objects.equals(this.username, updateCall.username) && + Objects.equals(this.password, updateCall.password) && + Objects.equals(this.redirectFallbackUrl, updateCall.redirectFallbackUrl) && + Objects.equals(this.redirectFallbackMethod, updateCall.redirectFallbackMethod) && + Objects.equals(this.fallbackUsername, updateCall.fallbackUsername) && + Objects.equals(this.fallbackPassword, updateCall.fallbackPassword) && + Objects.equals(this.tag, updateCall.tag)&& + Objects.equals(this.additionalProperties, updateCall.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(state, redirectUrl, redirectMethod, username, password, redirectFallbackUrl, redirectFallbackMethod, fallbackUsername, fallbackPassword, tag, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCall {\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).append("\n"); + sb.append(" redirectMethod: ").append(toIndentedString(redirectMethod)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" redirectFallbackUrl: ").append(toIndentedString(redirectFallbackUrl)).append("\n"); + sb.append(" redirectFallbackMethod: ").append(toIndentedString(redirectFallbackMethod)).append("\n"); + sb.append(" fallbackUsername: ").append(toIndentedString(fallbackUsername)).append("\n"); + sb.append(" fallbackPassword: ").append(toIndentedString(fallbackPassword)).append("\n"); + sb.append(" tag: ").append(toIndentedString(tag)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("state"); + openapiFields.add("redirectUrl"); + openapiFields.add("redirectMethod"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("redirectFallbackUrl"); + openapiFields.add("redirectFallbackMethod"); + openapiFields.add("fallbackUsername"); + openapiFields.add("fallbackPassword"); + openapiFields.add("tag"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCall + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCall.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCall is not found in the empty JSON string", UpdateCall.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("redirectUrl") != null && !jsonObj.get("redirectUrl").isJsonNull()) && !jsonObj.get("redirectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("redirectFallbackUrl") != null && !jsonObj.get("redirectFallbackUrl").isJsonNull()) && !jsonObj.get("redirectFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectFallbackUrl").toString())); + } + if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); + } + if ((jsonObj.get("fallbackPassword") != null && !jsonObj.get("fallbackPassword").isJsonNull()) && !jsonObj.get("fallbackPassword").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackPassword` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackPassword").toString())); + } + if ((jsonObj.get("tag") != null && !jsonObj.get("tag").isJsonNull()) && !jsonObj.get("tag").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tag` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tag").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCall.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCall' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCall.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCall value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateCall read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateCall instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCall given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCall + * @throws IOException if the JSON string is invalid with respect to UpdateCall + */ + public static UpdateCall fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCall.class); + } + + /** + * Convert an instance of UpdateCall to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java new file mode 100644 index 00000000..6c931dca --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/UpdateCallRecording.java @@ -0,0 +1,291 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.RecordingStateEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * UpdateCallRecording + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class UpdateCallRecording { + public static final String SERIALIZED_NAME_STATE = "state"; + @SerializedName(SERIALIZED_NAME_STATE) + private RecordingStateEnum state; + + public UpdateCallRecording() { + } + + public UpdateCallRecording state(RecordingStateEnum state) { + + this.state = state; + return this; + } + + /** + * Get state + * @return state + **/ + @javax.annotation.Nonnull + public RecordingStateEnum getState() { + return state; + } + + + public void setState(RecordingStateEnum state) { + this.state = state; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateCallRecording instance itself + */ + public UpdateCallRecording putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateCallRecording updateCallRecording = (UpdateCallRecording) o; + return Objects.equals(this.state, updateCallRecording.state)&& + Objects.equals(this.additionalProperties, updateCallRecording.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(state, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateCallRecording {\n"); + sb.append(" state: ").append(toIndentedString(state)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("state"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("state"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateCallRecording + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateCallRecording.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateCallRecording is not found in the empty JSON string", UpdateCallRecording.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateCallRecording.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateCallRecording.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateCallRecording' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateCallRecording.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateCallRecording value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateCallRecording read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateCallRecording instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateCallRecording given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateCallRecording + * @throws IOException if the JSON string is invalid with respect to UpdateCallRecording + */ + public static UpdateCallRecording fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateCallRecording.class); + } + + /** + * Convert an instance of UpdateCallRecording to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConference.java b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java new file mode 100644 index 00000000..f07d8ae5 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConference.java @@ -0,0 +1,539 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.bandwidth.sdk.model.ConferenceStateEnum; +import com.bandwidth.sdk.model.RedirectMethodEnum; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * UpdateConference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class UpdateConference { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private ConferenceStateEnum status = ConferenceStateEnum.ACTIVE; + + public static final String SERIALIZED_NAME_REDIRECT_URL = "redirectUrl"; + @SerializedName(SERIALIZED_NAME_REDIRECT_URL) + private URI redirectUrl; + + public static final String SERIALIZED_NAME_REDIRECT_METHOD = "redirectMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_METHOD) + private RedirectMethodEnum redirectMethod = RedirectMethodEnum.POST; + + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + + public static final String SERIALIZED_NAME_REDIRECT_FALLBACK_URL = "redirectFallbackUrl"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FALLBACK_URL) + private URI redirectFallbackUrl; + + public static final String SERIALIZED_NAME_REDIRECT_FALLBACK_METHOD = "redirectFallbackMethod"; + @SerializedName(SERIALIZED_NAME_REDIRECT_FALLBACK_METHOD) + private RedirectMethodEnum redirectFallbackMethod = RedirectMethodEnum.POST; + + public static final String SERIALIZED_NAME_FALLBACK_USERNAME = "fallbackUsername"; + @SerializedName(SERIALIZED_NAME_FALLBACK_USERNAME) + private String fallbackUsername; + + public static final String SERIALIZED_NAME_FALLBACK_PASSWORD = "fallbackPassword"; + @SerializedName(SERIALIZED_NAME_FALLBACK_PASSWORD) + private String fallbackPassword; + + public UpdateConference() { + } + + public UpdateConference status(ConferenceStateEnum status) { + + this.status = status; + return this; + } + + /** + * Get status + * @return status + **/ + @javax.annotation.Nullable + public ConferenceStateEnum getStatus() { + return status; + } + + + public void setStatus(ConferenceStateEnum status) { + this.status = status; + } + + + public UpdateConference redirectUrl(URI redirectUrl) { + + this.redirectUrl = redirectUrl; + return this; + } + + /** + * The URL to send the [conferenceRedirect](/docs/voice/webhooks/conferenceRedirect) event which will provide new BXML. Not allowed if `state` is `completed`, but required if `state` is `active`. + * @return redirectUrl + **/ + @javax.annotation.Nullable + public URI getRedirectUrl() { + return redirectUrl; + } + + + public void setRedirectUrl(URI redirectUrl) { + this.redirectUrl = redirectUrl; + } + + + public UpdateConference redirectMethod(RedirectMethodEnum redirectMethod) { + + this.redirectMethod = redirectMethod; + return this; + } + + /** + * Get redirectMethod + * @return redirectMethod + **/ + @javax.annotation.Nullable + public RedirectMethodEnum getRedirectMethod() { + return redirectMethod; + } + + + public void setRedirectMethod(RedirectMethodEnum redirectMethod) { + this.redirectMethod = redirectMethod; + } + + + public UpdateConference username(String username) { + + this.username = username; + return this; + } + + /** + * Basic auth username. + * @return username + **/ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public UpdateConference password(String password) { + + this.password = password; + return this; + } + + /** + * Basic auth password. + * @return password + **/ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public UpdateConference redirectFallbackUrl(URI redirectFallbackUrl) { + + this.redirectFallbackUrl = redirectFallbackUrl; + return this; + } + + /** + * A fallback url which, if provided, will be used to retry the `conferenceRedirect` webhook delivery in case `redirectUrl` fails to respond. Not allowed if `state` is `completed`. + * @return redirectFallbackUrl + **/ + @javax.annotation.Nullable + public URI getRedirectFallbackUrl() { + return redirectFallbackUrl; + } + + + public void setRedirectFallbackUrl(URI redirectFallbackUrl) { + this.redirectFallbackUrl = redirectFallbackUrl; + } + + + public UpdateConference redirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + + this.redirectFallbackMethod = redirectFallbackMethod; + return this; + } + + /** + * Get redirectFallbackMethod + * @return redirectFallbackMethod + **/ + @javax.annotation.Nullable + public RedirectMethodEnum getRedirectFallbackMethod() { + return redirectFallbackMethod; + } + + + public void setRedirectFallbackMethod(RedirectMethodEnum redirectFallbackMethod) { + this.redirectFallbackMethod = redirectFallbackMethod; + } + + + public UpdateConference fallbackUsername(String fallbackUsername) { + + this.fallbackUsername = fallbackUsername; + return this; + } + + /** + * Basic auth username. + * @return fallbackUsername + **/ + @javax.annotation.Nullable + public String getFallbackUsername() { + return fallbackUsername; + } + + + public void setFallbackUsername(String fallbackUsername) { + this.fallbackUsername = fallbackUsername; + } + + + public UpdateConference fallbackPassword(String fallbackPassword) { + + this.fallbackPassword = fallbackPassword; + return this; + } + + /** + * Basic auth password. + * @return fallbackPassword + **/ + @javax.annotation.Nullable + public String getFallbackPassword() { + return fallbackPassword; + } + + + public void setFallbackPassword(String fallbackPassword) { + this.fallbackPassword = fallbackPassword; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateConference instance itself + */ + public UpdateConference putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateConference updateConference = (UpdateConference) o; + return Objects.equals(this.status, updateConference.status) && + Objects.equals(this.redirectUrl, updateConference.redirectUrl) && + Objects.equals(this.redirectMethod, updateConference.redirectMethod) && + Objects.equals(this.username, updateConference.username) && + Objects.equals(this.password, updateConference.password) && + Objects.equals(this.redirectFallbackUrl, updateConference.redirectFallbackUrl) && + Objects.equals(this.redirectFallbackMethod, updateConference.redirectFallbackMethod) && + Objects.equals(this.fallbackUsername, updateConference.fallbackUsername) && + Objects.equals(this.fallbackPassword, updateConference.fallbackPassword)&& + Objects.equals(this.additionalProperties, updateConference.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(status, redirectUrl, redirectMethod, username, password, redirectFallbackUrl, redirectFallbackMethod, fallbackUsername, fallbackPassword, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateConference {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" redirectUrl: ").append(toIndentedString(redirectUrl)).append("\n"); + sb.append(" redirectMethod: ").append(toIndentedString(redirectMethod)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" redirectFallbackUrl: ").append(toIndentedString(redirectFallbackUrl)).append("\n"); + sb.append(" redirectFallbackMethod: ").append(toIndentedString(redirectFallbackMethod)).append("\n"); + sb.append(" fallbackUsername: ").append(toIndentedString(fallbackUsername)).append("\n"); + sb.append(" fallbackPassword: ").append(toIndentedString(fallbackPassword)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("redirectUrl"); + openapiFields.add("redirectMethod"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("redirectFallbackUrl"); + openapiFields.add("redirectFallbackMethod"); + openapiFields.add("fallbackUsername"); + openapiFields.add("fallbackPassword"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateConference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateConference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateConference is not found in the empty JSON string", UpdateConference.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("redirectUrl") != null && !jsonObj.get("redirectUrl").isJsonNull()) && !jsonObj.get("redirectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUrl").toString())); + } + if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + if ((jsonObj.get("redirectFallbackUrl") != null && !jsonObj.get("redirectFallbackUrl").isJsonNull()) && !jsonObj.get("redirectFallbackUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectFallbackUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectFallbackUrl").toString())); + } + if ((jsonObj.get("fallbackUsername") != null && !jsonObj.get("fallbackUsername").isJsonNull()) && !jsonObj.get("fallbackUsername").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackUsername` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackUsername").toString())); + } + if ((jsonObj.get("fallbackPassword") != null && !jsonObj.get("fallbackPassword").isJsonNull()) && !jsonObj.get("fallbackPassword").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fallbackPassword` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fallbackPassword").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateConference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateConference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateConference.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateConference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateConference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateConference instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateConference given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateConference + * @throws IOException if the JSON string is invalid with respect to UpdateConference + */ + public static UpdateConference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateConference.class); + } + + /** + * Convert an instance of UpdateConference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java new file mode 100644 index 00000000..5fdbf656 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/UpdateConferenceMember.java @@ -0,0 +1,364 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * UpdateConferenceMember + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class UpdateConferenceMember { + public static final String SERIALIZED_NAME_MUTE = "mute"; + @SerializedName(SERIALIZED_NAME_MUTE) + private Boolean mute; + + public static final String SERIALIZED_NAME_HOLD = "hold"; + @SerializedName(SERIALIZED_NAME_HOLD) + private Boolean hold; + + public static final String SERIALIZED_NAME_CALL_IDS_TO_COACH = "callIdsToCoach"; + @SerializedName(SERIALIZED_NAME_CALL_IDS_TO_COACH) + private List callIdsToCoach; + + public UpdateConferenceMember() { + } + + public UpdateConferenceMember mute(Boolean mute) { + + this.mute = mute; + return this; + } + + /** + * Whether or not this member is currently muted. Members who are muted are still able to hear other participants. Updates this member's mute status. Has no effect if omitted. + * @return mute + **/ + @javax.annotation.Nullable + public Boolean getMute() { + return mute; + } + + + public void setMute(Boolean mute) { + this.mute = mute; + } + + + public UpdateConferenceMember hold(Boolean hold) { + + this.hold = hold; + return this; + } + + /** + * Whether or not this member is currently on hold. Members who are on hold are not able to hear or speak in the conference. Updates this member's hold status. Has no effect if omitted. + * @return hold + **/ + @javax.annotation.Nullable + public Boolean getHold() { + return hold; + } + + + public void setHold(Boolean hold) { + this.hold = hold; + } + + + public UpdateConferenceMember callIdsToCoach(List callIdsToCoach) { + + this.callIdsToCoach = callIdsToCoach; + return this; + } + + public UpdateConferenceMember addCallIdsToCoachItem(String callIdsToCoachItem) { + if (this.callIdsToCoach == null) { + this.callIdsToCoach = new ArrayList<>(); + } + this.callIdsToCoach.add(callIdsToCoachItem); + return this; + } + + /** + * If this member had a value set for `callIdsToCoach` in its [Conference](/docs/voice/bxml/conference) verb or this list was added with a previous PUT request to modify the member, this is that list of calls. Modifies the calls that this member is coaching. Has no effect if omitted. See the documentation for the [Conference](/docs/voice/bxml/conference) verb for more details about coaching. Note that this will not add the matching calls to the conference; each call must individually execute a Conference verb to join. + * @return callIdsToCoach + **/ + @javax.annotation.Nullable + public List getCallIdsToCoach() { + return callIdsToCoach; + } + + + public void setCallIdsToCoach(List callIdsToCoach) { + this.callIdsToCoach = callIdsToCoach; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateConferenceMember instance itself + */ + public UpdateConferenceMember putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateConferenceMember updateConferenceMember = (UpdateConferenceMember) o; + return Objects.equals(this.mute, updateConferenceMember.mute) && + Objects.equals(this.hold, updateConferenceMember.hold) && + Objects.equals(this.callIdsToCoach, updateConferenceMember.callIdsToCoach)&& + Objects.equals(this.additionalProperties, updateConferenceMember.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(mute, hold, callIdsToCoach, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateConferenceMember {\n"); + sb.append(" mute: ").append(toIndentedString(mute)).append("\n"); + sb.append(" hold: ").append(toIndentedString(hold)).append("\n"); + sb.append(" callIdsToCoach: ").append(toIndentedString(callIdsToCoach)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("mute"); + openapiFields.add("hold"); + openapiFields.add("callIdsToCoach"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateConferenceMember + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateConferenceMember.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateConferenceMember is not found in the empty JSON string", UpdateConferenceMember.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("callIdsToCoach") != null && !jsonObj.get("callIdsToCoach").isJsonNull() && !jsonObj.get("callIdsToCoach").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `callIdsToCoach` to be an array in the JSON string but got `%s`", jsonObj.get("callIdsToCoach").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateConferenceMember.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateConferenceMember' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateConferenceMember.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateConferenceMember value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateConferenceMember read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateConferenceMember instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateConferenceMember given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateConferenceMember + * @throws IOException if the JSON string is invalid with respect to UpdateConferenceMember + */ + public static UpdateConferenceMember fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateConferenceMember.class); + } + + /** + * Convert an instance of UpdateConferenceMember to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java new file mode 100644 index 00000000..8025854c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeRequest.java @@ -0,0 +1,388 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerifyCodeRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class VerifyCodeRequest { + public static final String SERIALIZED_NAME_TO = "to"; + @SerializedName(SERIALIZED_NAME_TO) + private String to; + + public static final String SERIALIZED_NAME_SCOPE = "scope"; + @SerializedName(SERIALIZED_NAME_SCOPE) + private String scope; + + public static final String SERIALIZED_NAME_EXPIRATION_TIME_IN_MINUTES = "expirationTimeInMinutes"; + @SerializedName(SERIALIZED_NAME_EXPIRATION_TIME_IN_MINUTES) + private BigDecimal expirationTimeInMinutes; + + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + + public VerifyCodeRequest() { + } + + public VerifyCodeRequest to(String to) { + + this.to = to; + return this; + } + + /** + * The phone number to send the mfa code to. + * @return to + **/ + @javax.annotation.Nonnull + public String getTo() { + return to; + } + + + public void setTo(String to) { + this.to = to; + } + + + public VerifyCodeRequest scope(String scope) { + + this.scope = scope; + return this; + } + + /** + * An optional field to denote what scope or action the mfa code is addressing. If not supplied, defaults to \"2FA\". + * @return scope + **/ + @javax.annotation.Nullable + public String getScope() { + return scope; + } + + + public void setScope(String scope) { + this.scope = scope; + } + + + public VerifyCodeRequest expirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { + + this.expirationTimeInMinutes = expirationTimeInMinutes; + return this; + } + + /** + * The time period, in minutes, to validate the mfa code. By setting this to 3 minutes, it will mean any code generated within the last 3 minutes are still valid. The valid range for expiration time is between 0 and 15 minutes, exclusively and inclusively, respectively. + * minimum: 1 + * maximum: 15 + * @return expirationTimeInMinutes + **/ + @javax.annotation.Nonnull + public BigDecimal getExpirationTimeInMinutes() { + return expirationTimeInMinutes; + } + + + public void setExpirationTimeInMinutes(BigDecimal expirationTimeInMinutes) { + this.expirationTimeInMinutes = expirationTimeInMinutes; + } + + + public VerifyCodeRequest code(String code) { + + this.code = code; + return this; + } + + /** + * The generated mfa code to check if valid. + * @return code + **/ + @javax.annotation.Nonnull + public String getCode() { + return code; + } + + + public void setCode(String code) { + this.code = code; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerifyCodeRequest instance itself + */ + public VerifyCodeRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyCodeRequest verifyCodeRequest = (VerifyCodeRequest) o; + return Objects.equals(this.to, verifyCodeRequest.to) && + Objects.equals(this.scope, verifyCodeRequest.scope) && + Objects.equals(this.expirationTimeInMinutes, verifyCodeRequest.expirationTimeInMinutes) && + Objects.equals(this.code, verifyCodeRequest.code)&& + Objects.equals(this.additionalProperties, verifyCodeRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(to, scope, expirationTimeInMinutes, code, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyCodeRequest {\n"); + sb.append(" to: ").append(toIndentedString(to)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" expirationTimeInMinutes: ").append(toIndentedString(expirationTimeInMinutes)).append("\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("to"); + openapiFields.add("scope"); + openapiFields.add("expirationTimeInMinutes"); + openapiFields.add("code"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("to"); + openapiRequiredFields.add("expirationTimeInMinutes"); + openapiRequiredFields.add("code"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerifyCodeRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyCodeRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerifyCodeRequest is not found in the empty JSON string", VerifyCodeRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : VerifyCodeRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("to").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `to` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to").toString())); + } + if ((jsonObj.get("scope") != null && !jsonObj.get("scope").isJsonNull()) && !jsonObj.get("scope").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `scope` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scope").toString())); + } + if (!jsonObj.get("code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyCodeRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyCodeRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerifyCodeRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyCodeRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerifyCodeRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerifyCodeRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyCodeRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyCodeRequest + * @throws IOException if the JSON string is invalid with respect to VerifyCodeRequest + */ + public static VerifyCodeRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyCodeRequest.class); + } + + /** + * Convert an instance of VerifyCodeRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java new file mode 100644 index 00000000..db5ad42c --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VerifyCodeResponse.java @@ -0,0 +1,282 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VerifyCodeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class VerifyCodeResponse { + public static final String SERIALIZED_NAME_VALID = "valid"; + @SerializedName(SERIALIZED_NAME_VALID) + private Boolean valid; + + public VerifyCodeResponse() { + } + + public VerifyCodeResponse valid(Boolean valid) { + + this.valid = valid; + return this; + } + + /** + * Whether or not the supplied code is valid. + * @return valid + **/ + @javax.annotation.Nullable + public Boolean getValid() { + return valid; + } + + + public void setValid(Boolean valid) { + this.valid = valid; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VerifyCodeResponse instance itself + */ + public VerifyCodeResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VerifyCodeResponse verifyCodeResponse = (VerifyCodeResponse) o; + return Objects.equals(this.valid, verifyCodeResponse.valid)&& + Objects.equals(this.additionalProperties, verifyCodeResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(valid, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VerifyCodeResponse {\n"); + sb.append(" valid: ").append(toIndentedString(valid)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("valid"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VerifyCodeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VerifyCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VerifyCodeResponse is not found in the empty JSON string", VerifyCodeResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VerifyCodeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VerifyCodeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VerifyCodeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VerifyCodeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VerifyCodeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VerifyCodeResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VerifyCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VerifyCodeResponse + * @throws IOException if the JSON string is invalid with respect to VerifyCodeResponse + */ + public static VerifyCodeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VerifyCodeResponse.class); + } + + /** + * Convert an instance of VerifyCodeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java new file mode 100644 index 00000000..0d22e785 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VoiceApiError.java @@ -0,0 +1,359 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VoiceApiError + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class VoiceApiError { + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public VoiceApiError() { + } + + public VoiceApiError type(String type) { + + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @javax.annotation.Nullable + public String getType() { + return type; + } + + + public void setType(String type) { + this.type = type; + } + + + public VoiceApiError description(String description) { + + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + + public void setDescription(String description) { + this.description = description; + } + + + public VoiceApiError id(String id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VoiceApiError instance itself + */ + public VoiceApiError putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VoiceApiError voiceApiError = (VoiceApiError) o; + return Objects.equals(this.type, voiceApiError.type) && + Objects.equals(this.description, voiceApiError.description) && + Objects.equals(this.id, voiceApiError.id)&& + Objects.equals(this.additionalProperties, voiceApiError.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(type, description, id, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VoiceApiError {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("type"); + openapiFields.add("description"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VoiceApiError + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VoiceApiError.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VoiceApiError is not found in the empty JSON string", VoiceApiError.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VoiceApiError.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VoiceApiError' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VoiceApiError.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VoiceApiError value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VoiceApiError read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VoiceApiError instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VoiceApiError given an JSON string + * + * @param jsonString JSON string + * @return An instance of VoiceApiError + * @throws IOException if the JSON string is invalid with respect to VoiceApiError + */ + public static VoiceApiError fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VoiceApiError.class); + } + + /** + * Convert an instance of VoiceApiError to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java new file mode 100644 index 00000000..cc7fd861 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/VoiceCodeResponse.java @@ -0,0 +1,285 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.bandwidth.sdk.JSON; + +/** + * VoiceCodeResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-08-29T14:24:34.966664-04:00[America/New_York]") +public class VoiceCodeResponse { + public static final String SERIALIZED_NAME_CALL_ID = "callId"; + @SerializedName(SERIALIZED_NAME_CALL_ID) + private String callId; + + public VoiceCodeResponse() { + } + + public VoiceCodeResponse callId(String callId) { + + this.callId = callId; + return this; + } + + /** + * Programmable Voice API Call ID. + * @return callId + **/ + @javax.annotation.Nullable + public String getCallId() { + return callId; + } + + + public void setCallId(String callId) { + this.callId = callId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the VoiceCodeResponse instance itself + */ + public VoiceCodeResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VoiceCodeResponse voiceCodeResponse = (VoiceCodeResponse) o; + return Objects.equals(this.callId, voiceCodeResponse.callId)&& + Objects.equals(this.additionalProperties, voiceCodeResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(callId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VoiceCodeResponse {\n"); + sb.append(" callId: ").append(toIndentedString(callId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("callId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to VoiceCodeResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!VoiceCodeResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in VoiceCodeResponse is not found in the empty JSON string", VoiceCodeResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("callId") != null && !jsonObj.get("callId").isJsonNull()) && !jsonObj.get("callId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `callId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("callId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!VoiceCodeResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'VoiceCodeResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(VoiceCodeResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, VoiceCodeResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public VoiceCodeResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + VoiceCodeResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of VoiceCodeResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of VoiceCodeResponse + * @throws IOException if the JSON string is invalid with respect to VoiceCodeResponse + */ + public static VoiceCodeResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, VoiceCodeResponse.class); + } + + /** + * Convert an instance of VoiceCodeResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/AudioProducer.java b/src/main/java/com/bandwidth/sdk/model/bxml/AudioProducer.java new file mode 100644 index 00000000..a4607ecc --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/AudioProducer.java @@ -0,0 +1,16 @@ +package com.bandwidth.sdk.model.bxml; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * A marker interface for BXML verbs that process audio output. The class annotations describe how + * Jackson should serialize and deserialize verbs. + */ +@JsonSubTypes({ + @JsonSubTypes.Type(value = PlayAudio.class, name = PlayAudio.TYPE_NAME), + @JsonSubTypes.Type(value = SpeakSentence.class, name = SpeakSentence.TYPE_NAME), +}) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "name") +public interface AudioProducer extends Verb { +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Bridge.java b/src/main/java/com/bandwidth/sdk/model/bxml/Bridge.java new file mode 100644 index 00000000..05085429 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Bridge.java @@ -0,0 +1,112 @@ +/** + * The {@code } verb is used to bridge another party (target call) onto the current call. + * When the target call is bridged, any BXML being executed in it will be cancelled. + * The bridge ends when one of the calls leaves the bridge. A call leaves the bridge when it is hung up or when it gets redirected to another BXML. + * The Bridge Complete and Bridge Target Complete callbacks are sent when the bridge ends, to allow the call that remained in the bridge to execute new BXML. + * + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Bridge implements Verb { + + /** + * + * @param targetCallId (str): String containing the callId of the call to be bridged. + * @param bridgeCompleteUrl (str, optional): URL to send the Bridge Complete event to and request new BXML. + * If this attribute is specified, then Verbs following the verb will be ignored and the BXML returned in this webhook is executed on the call. + * If this attribute is not specified then no webhook will be sent, and execution of the verbs following the verb continues. May be a relative URL. Defaults to None. + * @param bridgeCompleteMethod (str, optional): The HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST. + * @param bridgeCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Bridge Complete webhook delivery in case bridgeCompleteUrl fails to respond. Defaults to None. + * @param bridgeCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Bridge Complete webhook to bridgeCompleteFallbackUrl. GET or POST. Default value is POST. + * @param bridgeTargetCompleteUrl (str, optional):URL to send the Bridge Target Complete event to and request new BXML. + * If this attribute is specified, then the BXML returned in this webhook is executed on the target call. + * If this attribute is not specified then no webhook will be sent, and the target call will be hung up. May be a relative URL. Defaults to None. + * @param bridgeTargetCompleteMethod (str, optional): The HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST. + * @param bridgeTargetCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Bridge Target Complete webhook delivery in case bridgeTargetCompleteUrl fails to respond. Defaults to None. + * @param bridgeTargetCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Bridge Target Complete webhook to bridgeTargetCompleteFallbackUrl. GET or POST. Default value is POST. + * @param username (str, optional): The username to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with the bridgeComplete webhook and all future webhooks of the call unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. + * + */ + + public static final String TYPE_NAME = "Bridge"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String targetCallId; + + @XmlAttribute + protected String bridgeCompleteUrl; + + @XmlAttribute + @Default + protected String bridgeCompleteMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String bridgeCompleteFallbackUrl; + + @XmlAttribute + @Default + protected String bridgeCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String bridgeTargetCompleteUrl; + + @XmlAttribute + @Default + protected String bridgeTargetCompleteMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String bridgeTargetCompleteFallbackUrl; + + @XmlAttribute + @Default + protected String bridgeTargetCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String tag; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Bxml.java b/src/main/java/com/bandwidth/sdk/model/bxml/Bxml.java new file mode 100644 index 00000000..1a6e5a24 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Bxml.java @@ -0,0 +1,87 @@ +/** + * The root {@code } verb. Other verbs get added to BXML and then the JAXB marshaller using the toBxml() method converts this to valid BXML. + * + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@XmlRootElement(name = "Bxml") +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Builder +@EqualsAndHashCode +public class Bxml { + + @XmlElements({ + @XmlElement(name = Bridge.TYPE_NAME, type = Bridge.class), + @XmlElement(name = Conference.TYPE_NAME, type = Conference.class), + @XmlElement(name = Forward.TYPE_NAME, type = Forward.class), + @XmlElement(name = Gather.TYPE_NAME, type = Gather.class), + @XmlElement(name = Hangup.TYPE_NAME, type = Hangup.class), + @XmlElement(name = Pause.TYPE_NAME, type = Pause.class), + @XmlElement(name = PauseRecording.TYPE_NAME, type = PauseRecording.class), + @XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class), + @XmlElement(name = Record.TYPE_NAME, type = Record.class), + @XmlElement(name = Redirect.TYPE_NAME, type = Redirect.class), + @XmlElement(name = ResumeRecording.TYPE_NAME, type = ResumeRecording.class), + @XmlElement(name = Ring.TYPE_NAME, type = Ring.class), + @XmlElement(name = SendDtmf.TYPE_NAME, type = SendDtmf.class), + @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class), + @XmlElement(name = StartRecording.TYPE_NAME, type = StartRecording.class), + @XmlElement(name = StopRecording.TYPE_NAME, type = StopRecording.class), + @XmlElement(name = StartGather.TYPE_NAME, type = StartGather.class), + @XmlElement(name = StopGather.TYPE_NAME, type = StopGather.class), + @XmlElement(name = Tag.TYPE_NAME, type = Tag.class), + @XmlElement(name = Transfer.TYPE_NAME, type = Transfer.class), + @XmlElement(name = StartStream.TYPE_NAME, type = StartStream.class), + @XmlElement(name = StopStream.TYPE_NAME, type = StopStream.class), + @XmlElement(name = StartTranscription.TYPE_NAME, type = StartTranscription.class), + @XmlElement(name = StopTranscription.TYPE_NAME, type = StopTranscription.class), + + }) + + private List verbs = new ArrayList<>(); + + public Bxml with(Verb verb) { + this.verbs.add(verb); + return this; + } + + public Bxml withVerbs(Verb... verbs) { + this.verbs.addAll(Arrays.asList(verbs)); + return this; + } + + public String toBxml(JAXBContext jaxbContext) { + OutputStream outputStream = new ByteArrayOutputStream(); + try { + getMarshaller(jaxbContext).marshal(this, outputStream); + } catch (JAXBException e) { + throw new RuntimeException("Error creating BXML marshaller", e); + } + return outputStream.toString(); + } + + private Marshaller getMarshaller(JAXBContext context) throws JAXBException { + return context.createMarshaller(); + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Conference.java b/src/main/java/com/bandwidth/sdk/model/bxml/Conference.java new file mode 100644 index 00000000..71ac7327 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Conference.java @@ -0,0 +1,121 @@ +/** + * The {@code } verb is used to join the current call into a conference. + * Conference names are created and specified by your application. Conferences are implicitly created the first time your application uses a conference name, + * and they are implicitly deleted when the last member leaves the conference. We will create a unique ID for the conference, + * so your conference names can be whatever you want. If the conference ends and then you later use the same conference name, a new unique ID will be created. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_EMPTY_STRING; + + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Conference implements Verb { + + /** + * + * @param name (str): The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and . + * @param mute (str, optional): A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false. + * @param hold (str, optional): A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false. + * @param callIdsToCoach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. + * Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. + * @param conferenceEventUrl (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, + * and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password), + * they will be ignored and the original webhook information will be used. This URL may be a relative endpoint. + * @param conferenceEventMethod (str, optional): The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST. + * @param conferenceEventFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond. + * @param conferenceEventFallbackMethod (str, optional): The HTTP method to use to deliver the conference webhooks to conferenceEventFallbackUrl. GET or POST. Default value is POST. + * @param username (str, optional):The username to send in the HTTP request to conferenceEventUrl. + * @param password (str, optional): The password to send in the HTTP request to conferenceEventUrl. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to conferenceEventFallbackUrl. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to conferenceEventFallbackUrl. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". + * Max length 256 characters. Defaults to None. + * @param callbackTimeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference. + * If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25 * @parameter + * Nested Verbs: + * @param PlayAudio: (optional) + * @param SpeakSentence: (optional) + * @param StartRecording: (optional) + * @param StopRecording: (optional) + * @param PauseRecording: (optional) + * @param ResumeRecording: (optional) + */ + + public static final String TYPE_NAME = "Conference"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String name; + + @XmlAttribute + @Default + protected Boolean mute = false; + + @XmlAttribute + @Default + protected Boolean hold = false; + + @XmlAttribute + protected String conferenceEventUrl; + + @XmlAttribute + @Default + protected String conferenceEventMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String conferenceEventFallbackUrl; + + @XmlAttribute + @Default + protected String conferenceEventFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected Double callbackTimeout; + + @XmlAttribute + protected String tag; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + @Default + protected String callIdsToCoach = DEFAULT_EMPTY_STRING; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/CustomParam.java b/src/main/java/com/bandwidth/sdk/model/bxml/CustomParam.java new file mode 100644 index 00000000..641a0891 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/CustomParam.java @@ -0,0 +1,37 @@ +/** + * The {@code } verb is used to define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started. + * You may specify up to 12 {@code } elements nested within a {@code } tag. + */ + +package com.bandwidth.sdk.model.bxml; + + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@XmlType(name = CustomParam.TYPE_NAME) +@XmlAccessorType(XmlAccessType.FIELD) +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CustomParam { + /** + * + * @param name (str): The name of this parameter, up to 256 characters. + * @param value (str): The value of this parameter, up to 2048 characters. + * + */ + public static final String TYPE_NAME = "CustomParam"; + + @XmlAttribute + protected String name; + @XmlAttribute + protected String value; +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java b/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java new file mode 100644 index 00000000..aebea3bd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java @@ -0,0 +1,86 @@ +/** + * The {@code } verb is used to forward an unanswered incoming call to another number. Unlike {@code }, once your call is forwarded, + * your application will not have any control over either leg of the call. When either leg hangs up, a Disconnect event will be sent to your Call status webhook URL. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALL_TIMEOUT; + +import com.bandwidth.sdk.model.DiversionReason; +import com.bandwidth.sdk.model.DiversionTreatment; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Forward.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Forward implements Verb { + /** + * + * @param to (str): The phone number destination of the call. + * @param from_ (str, optional): The phone number that the recipient will receive the call from. + * @param callTimeout (str, optional): The number of seconds to wait before timing out the call. + * @param diversionTreatment (str, optional): Can be any of the following: + * none: No diversion headers are sent on the outbound leg of the transferred call. + * propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. + * stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. + * Defaults to none. If diversionTreatment is not specified, no diversion header will be included for the transfer even if one came with the inbound call. Defaults to None. + * @param diversionReason (str, optional): Can be any of the following values: + * unknown + * user-busy + * no-answer + * unavailable + * unconditional + * time-of-day + * do-not-disturb + * deflection + * follow-me + * out-of-service + * away + * This parameter is considered only when diversionTreatment is set to stack. Defaults is unknown. + * Defaults to None. + * @param uui (str, optional): The value of the User-To-User header to send within the outbound INVITE when forwarding to a SIP URI. + * Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. + * This value, including the encoding specifier, may not exceed 256 characters. + */ + + public static final String TYPE_NAME = "Forward"; + + @XmlAttribute + private String to; + + @XmlAttribute + private String from; + + @XmlAttribute + private String uui; + + @XmlAttribute + @Builder.Default + private Double callTimeout = DEFAULT_CALL_TIMEOUT; + + @XmlAttribute + @Builder.Default + private DiversionTreatment diversionTreatment = DiversionTreatment.NONE; + + @XmlAttribute + @Builder.Default + private DiversionReason diversionReason = DiversionReason.UNKNOWN; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java b/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java new file mode 100644 index 00000000..59557ef7 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java @@ -0,0 +1,123 @@ +/** + * The {@code } verb is used to collect digits for some period of time. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_FIRSTDIGIT_TIMEOUT; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_INTERDIGIT_TIMEOUT; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_MAX_DIGITS; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_REPEAT_COUNT; + + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlType; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Gather.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Gather implements Verb { + /** + * + * @param gatherUrl (str, optional): URL to send Gather event to and request new BXML. May be a relative URL. + * @param gatherMethod (str, optional): The HTTP method to use for the request to gather_url. GET or POST. Default value is POST. + * @param gatherFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Gather event callback delivery in case gather_url fails to respond. + * @param gatherFallbackMethod (str, optional): The HTTP method to use to deliver the Gather event callback to gather_fallback_url. GET or POST. Default value is POST. + * @param username (str, optional): The username to send in the HTTP request to gather_url. + * @param password (str, optional): The password to send in the HTTP request to gather_url. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to gather_fallback_url. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to gather_fallback_url. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. + * May be cleared by setting tag="". Max length 256 characters. + * @param terminatingDigits (str, optional): When any of these digits are pressed, it will terminate the Gather. Default value is "", which disables this feature. + * @param maxDigits (int, optional): Max number of digits to collect. Default value is 50. Range: decimal values between 1 - 50. + * @param interDigitTimeout (int, optional): Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60. + * @param firstDigitTimeout (int, optional): Time (in seconds) to pause after any audio from nested or verb is played (in seconds) before terminating the Gather. + * Default value is 5. Range: decimal values between 0 - 60. + * @param repeatCount (int, optional): The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. + * The delay between repetitions will be equal to first_digit_timeout. Default value is 1. repeat_count * number of verbs must not be greater than 20. + * + * Nested Verbs: + * @param PlayAudio: (optional) Using the PlayAudio inside the Gather verb will play the media until a digit is received. + * @param SpeakSentence: (optional) Using the SpeakSentence inside the Gather verb will speak the text until a digit is received. + */ + + public static final String TYPE_NAME = "Gather"; + + @XmlElements({ + @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class), + @XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class) + }) + protected List children; + + @XmlAttribute + @Getter + protected String gatherUrl; + + @XmlAttribute + @Getter + protected String gatherFallbackUrl; + + @XmlAttribute + @Default + protected String gatherMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + @Default + protected String gatherFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + protected String tag; + + @XmlAttribute + protected String terminatingDigits; + + @XmlAttribute + @Default + protected Integer maxDigits = DEFAULT_MAX_DIGITS; + + @XmlAttribute + @Default + protected Double firstDigitTimeout = DEFAULT_FIRSTDIGIT_TIMEOUT; + + @XmlAttribute + @Default + protected Double interDigitTimeout = DEFAULT_INTERDIGIT_TIMEOUT; + + @XmlAttribute + @Default + protected int repeatCount = DEFAULT_REPEAT_COUNT; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Hangup.java b/src/main/java/com/bandwidth/sdk/model/bxml/Hangup.java new file mode 100644 index 00000000..7ed917dd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Hangup.java @@ -0,0 +1,34 @@ +/** + * The {@code } verb is used to hang up the current call. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlType; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Hangup.TYPE_NAME) +@NoArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Hangup implements Verb { + + public static final String TYPE_NAME = "Hangup"; + + @Override + public String toString() { + return TYPE_NAME; + } + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/OutboundDestination.java b/src/main/java/com/bandwidth/sdk/model/bxml/OutboundDestination.java new file mode 100644 index 00000000..701d061b --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/OutboundDestination.java @@ -0,0 +1,35 @@ +/** + * Represents a {@code } or {@code } element inside a BXML Transfer or Forward verb + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType +public interface OutboundDestination { + String getUsername(); + + String getPassword(); + + String getTransferAnswerUrl(); + + String getTransferAnswerMethod(); + + String getTransferDisconnectUrl(); + + String getTransferDisconnectMethod(); + + String getFallbackUsername(); + + String getFallbackPassword(); + + String getTransferAnswerFallbackUrl(); + + String getTransferAnswerFallbackMethod(); + + String getTag(); +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Pause.java b/src/main/java/com/bandwidth/sdk/model/bxml/Pause.java new file mode 100644 index 00000000..8f9fb5de --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Pause.java @@ -0,0 +1,43 @@ +/** + * The {@code } verb is used to delay verb execution for a period of time, during which the call will be silent. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_PAUSE_DURATION; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Pause.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Pause implements Verb { + /** + * + * @param duration (str, optional): The time in seconds to pause. Default value is 1. + */ + + public static final String TYPE_NAME = "Pause"; + + @XmlAttribute + @Default + protected Double duration = DEFAULT_PAUSE_DURATION; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/PauseRecording.java b/src/main/java/com/bandwidth/sdk/model/bxml/PauseRecording.java similarity index 55% rename from src/main/java/com/bandwidth/voice/bxml/verbs/PauseRecording.java rename to src/main/java/com/bandwidth/sdk/model/bxml/PauseRecording.java index 74864c1b..67fc2e45 100644 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/PauseRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/PauseRecording.java @@ -1,24 +1,22 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; - /** - * The PauseRecording verb is used to pause a recording that was previously started by a verb. - *
+ * The {@code } verb is used to pause a recording that was previously started by a verb. * Audio that occurs between a verb and a verb will not be present in the recording. - *
* The paused period will not be included in the duration of the recording and therefore will not contribute to the recording portion of the bill. - *
* If there is not an ongoing recording at the time of this verb's execution, it has no effect. - *
- * The Hangup verb is also used to reject incoming calls either explicitly or implicitly. */ -@Builder -@XmlType(name = PauseRecording.TYPE_NAME) +package com.bandwidth.sdk.model.bxml; + +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@EqualsAndHashCode public class PauseRecording implements Verb { + public static final String TYPE_NAME = "PauseRecording"; + @Override + public String getVerbName() { + return TYPE_NAME; + } } diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/PhoneNumber.java b/src/main/java/com/bandwidth/sdk/model/bxml/PhoneNumber.java new file mode 100644 index 00000000..dfdf67a4 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/PhoneNumber.java @@ -0,0 +1,89 @@ +/** + * The {@code } verb is used within the tag to define the called parties. Between 1 and 8 {@code }or {@code }tags must be nested + * If more than one destination is specified, called parties will ring simultaneously and the first to answer will be bridged to the original call. + */ +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = PhoneNumber.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class PhoneNumber implements OutboundDestination { + /** + * + * @param number (str): A phone number to transfer the call to. Value must be in E.164 format (e.g. +15555555555). + * @param transferAnswerUrl (str, optional): URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged. May be a relative URL. Defaults to None. + * @param transferAnswerMethod (str, optional): The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. Defaults to None. + * @param transferAnswerFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Transfer Answer callback delivery in case transferAnswerUrl fails to respond. Defaults to None. + * @param transferAnswerFallbackMethod (str, optional): The HTTP method to use to deliver the Transfer Answer callback to transferAnswerFallbackUrl. GET or POST. Default value is POST. Defaults to None. + * @param transferDisconnectUrl (str, optional): URL, if any, to send the Transfer Disconnect event to. This event will be sent regardless of how the transfer ends and may not be responded to with BXML. May be a relative URL. Defaults to None. + * @param transferDisconnectMethod (str, optional): The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. Defaults to Defaults to Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None. + * + */ + + public static final String TYPE_NAME = "PhoneNumber"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String number; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + protected String transferAnswerUrl; + + @XmlAttribute + @Default + protected String transferAnswerMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String transferAnswerFallbackUrl; + + @XmlAttribute + @Default + protected String transferAnswerFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String transferDisconnectUrl; + + @XmlAttribute + @Default + protected String transferDisconnectMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String tag; +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/PlayAudio.java b/src/main/java/com/bandwidth/sdk/model/bxml/PlayAudio.java new file mode 100644 index 00000000..c040f712 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/PlayAudio.java @@ -0,0 +1,56 @@ +/** + * The {@code } verb is used to play an audio file in the call. + * The URL of an audio file should be included in the body of the {@code } tag. If a relative URL is given, it is resolved relative to the endpoint that returned the BXML. + */ +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import java.net.URI; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = PlayAudio.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class PlayAudio implements AudioProducer { + /** + * + * @param audioUri (str): The URL of the audio file to play. May be a relative URL. + * @param username (str, optional): The username to send in the HTTP request to audio_uri. + * @param password (str, optional): The password to send in the HTTP request to audio_uri. + * + */ + + public static final String TYPE_NAME = "PlayAudio"; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlValue + protected String audioUri; + + public PlayAudio(String audioUri) { + this.audioUri = audioUri; + } + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Record.java b/src/main/java/com/bandwidth/sdk/model/bxml/Record.java new file mode 100644 index 00000000..53c8bb8d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Record.java @@ -0,0 +1,123 @@ +/** + * The root {@code } verb is used to allow a segment of audio to be recorded during a call. At the end of the recording, a Record Complete event is generated. + * This verb should probably be used if you are building a voice mail system or conference member introduction. For different use cases, you might want to take a look at {@code }. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_RECORD_AUDIO_FORMAT; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_RECORD_MAX_DURATION; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_RECORD_SILENCE_TIMEOUT; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_TERMINATING_DIGITS; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Record.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Record implements TranscriptionProducer { + /** + * + * @param recordCompleteUrl (str, optional): URL to send the Record Complete event to once the recording has ended. Accepts BXML, and may be a relative URL. This callback will not be sent if the recording ended due to the call hanging up. Defaults to None. + * @param recordCompleteMethod (str, optional): The HTTP method to use for the request to recordCompleteUrl. GET or POST. Default value is POST. Defaults to None. + * @param recordCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Record Complete callback delivery in case recordCompleteUrl fails to respond. Defaults to None. + * @param recordCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Record Complete callback to recordCompleteFallbackUrl. GET or POST. Default value is POST. Defaults to None. + * @param recordingAvailableUrl (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. + * @param recordingAvailableMethod (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. Defaults to None. + * @param transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + * @param transcriptionAvailableUrl (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. + * @param transcriptionAvailableMethod (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to recordCompleteFallbackUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. + * @param terminatingDigits (str, optional): When pressed, this digit will terminate the recording. Default value is “#”. This feature can be disabled with "". Defaults to None. + * @param maxDuration (int, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. + * @param silenceTimeout (str, optional): Length of silence after which to end the recording (in seconds). Max is equivalent to the maximum maxDuration value. Default value is 0, which means no timeout. Defaults to None. + * @param fileFormat (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. + * + */ + + public static final String TYPE_NAME = "Record"; + + @XmlAttribute + protected String recordCompleteUrl; + + @XmlAttribute + protected String recordCompleteFallbackUrl; + + @XmlAttribute + @Default + protected String recordCompleteMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + @Default + protected String recordCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String tag; + + @XmlAttribute + @Default + protected String terminatingDigits = DEFAULT_TERMINATING_DIGITS; + + @XmlAttribute + @Default + protected Integer maxDuration = DEFAULT_RECORD_MAX_DURATION; + + @XmlAttribute + @Default + protected String fileFormat = DEFAULT_RECORD_AUDIO_FORMAT; + + @XmlAttribute + protected String recordingAvailableUrl; + + @XmlAttribute + @Default + protected String recordingAvailableMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected Boolean transcribe; + + @XmlAttribute + @Default + protected Double silenceTimeout = DEFAULT_RECORD_SILENCE_TIMEOUT; + + @XmlAttribute + protected String transcriptionAvailableUrl; + + @XmlAttribute + protected String transcriptionAvailableMethod; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Redirect.java b/src/main/java/com/bandwidth/sdk/model/bxml/Redirect.java new file mode 100644 index 00000000..d12bd0f0 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Redirect.java @@ -0,0 +1,81 @@ +/** + * The {@code } verb is used to redirect the current XML execution to another URL. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlTransient; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Redirect.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Redirect implements Verb { + /** + * + * @param redirectUrl (str): URL to request new BXML from. A Redirect event will be sent to this endpoint. May be a relative URL. Defaults to None. + * @param redirectMethod (str, optional): The HTTP method to use for the request to redirectUrl. GET or POST. Defaults to None. + * @param redirectFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Redirect callback delivery in case redirectUrl fails to respond. Defaults to None. + * @param redirectFallbackMethod (str, optional): The HTTP method to use to deliver the Redirect callback to redirectFallbackUrl. GET or POST. Default value is POST. Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to redirectUrl. Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to redirectUrl. Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to redirectFallbackUrl. Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to redirectFallbackUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. + * + */ + + public static final String TYPE_NAME = "Redirect"; + + @XmlTransient + private String eventType; + + @XmlAttribute(required = true) + protected String redirectUrl; + + @XmlAttribute + protected String redirectFallbackUrl; + + @XmlAttribute + @Default + protected String redirectMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + @Default + protected String redirectFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + protected String tag; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Response.java b/src/main/java/com/bandwidth/sdk/model/bxml/Response.java new file mode 100644 index 00000000..d1e8a532 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Response.java @@ -0,0 +1,84 @@ +/** + * The root {@code } verb. Other verbs get added to Response and then the JAXB marshaller using the toBxml() method converts this to valid BXML. + * + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlRootElement; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@XmlRootElement(name = "Response") +@NoArgsConstructor +@AllArgsConstructor +@Getter +@EqualsAndHashCode +public class Response { + + @XmlElements({ + @XmlElement(name = Bridge.TYPE_NAME, type = Bridge.class), + @XmlElement(name = Conference.TYPE_NAME, type = Conference.class), + @XmlElement(name = Forward.TYPE_NAME, type = Forward.class), + @XmlElement(name = Gather.TYPE_NAME, type = Gather.class), + @XmlElement(name = Hangup.TYPE_NAME, type = Hangup.class), + @XmlElement(name = Pause.TYPE_NAME, type = Pause.class), + @XmlElement(name = PauseRecording.TYPE_NAME, type = PauseRecording.class), + @XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class), + @XmlElement(name = Record.TYPE_NAME, type = Record.class), + @XmlElement(name = Redirect.TYPE_NAME, type = Redirect.class), + @XmlElement(name = ResumeRecording.TYPE_NAME, type = ResumeRecording.class), + @XmlElement(name = Ring.TYPE_NAME, type = Ring.class), + @XmlElement(name = SendDtmf.TYPE_NAME, type = SendDtmf.class), + @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class), + @XmlElement(name = StartRecording.TYPE_NAME, type = StartRecording.class), + @XmlElement(name = StopRecording.TYPE_NAME, type = StopRecording.class), + @XmlElement(name = StartGather.TYPE_NAME, type = StartGather.class), + @XmlElement(name = StopGather.TYPE_NAME, type = StopGather.class), + @XmlElement(name = Tag.TYPE_NAME, type = Tag.class), + @XmlElement(name = Transfer.TYPE_NAME, type = Transfer.class), + @XmlElement(name = StartStream.TYPE_NAME, type = StartStream.class), + @XmlElement(name = StopStream.TYPE_NAME, type = StopStream.class), + @XmlElement(name = StartTranscription.TYPE_NAME, type = StartTranscription.class), + @XmlElement(name = StopTranscription.TYPE_NAME, type = StopTranscription.class), + }) + + private List verbs = new ArrayList<>(); + + public Response with(Verb verb) { + this.verbs.add(verb); + return this; + } + + public Response withVerbs(Verb... verbs) { + this.verbs.addAll(Arrays.asList(verbs)); + return this; + } + + public String toBxml(JAXBContext jaxbContext) { + OutputStream outputStream = new ByteArrayOutputStream(); + try { + getMarshaller(jaxbContext).marshal(this, outputStream); + } catch (JAXBException e) { + throw new RuntimeException("Error creating BXML marshaller", e); + } + return outputStream.toString(); + } + + private Marshaller getMarshaller(JAXBContext context) throws JAXBException { + return context.createMarshaller(); + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/ResumeRecording.java b/src/main/java/com/bandwidth/sdk/model/bxml/ResumeRecording.java new file mode 100644 index 00000000..b80c938e --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/ResumeRecording.java @@ -0,0 +1,20 @@ +/** + * The {@code } verb is used to resume a recording that was previously paused by a {@code } verb. + */ + +package com.bandwidth.sdk.model.bxml; + +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@EqualsAndHashCode +public class ResumeRecording implements Verb { + + public static final String TYPE_NAME = "ResumeRecording"; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Ring.java b/src/main/java/com/bandwidth/sdk/model/bxml/Ring.java new file mode 100644 index 00000000..d1769661 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Ring.java @@ -0,0 +1,47 @@ +/** + * The {@code } verb is used to play ringing audio on a call. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Ring.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Ring implements Verb { + /** + * + * @param duration (double, optional): How many seconds to play ringing on the call. Default value is 5. Range: decimal values between 0.1 - 86400. + * @param answerCall (bool, optional): A boolean indicating whether or not to answer the call when Ring is executed on an unanswered incoming call. Default value is 'true'. + * + */ + + public static final String TYPE_NAME = "Ring"; + + @XmlAttribute + @Default + protected Double duration = 2d; + + @XmlAttribute + @Default + protected Boolean answerCall = true; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/SendDtmf.java b/src/main/java/com/bandwidth/sdk/model/bxml/SendDtmf.java new file mode 100644 index 00000000..65552976 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/SendDtmf.java @@ -0,0 +1,64 @@ +/** + * The {@code } verb is used to play DTMF digits in the call. + * The , and lowercase w characters introduce a half-second pause into the DTMF sequence. + * An uppercase W character introduces a one-second pause into the DTMF sequence. + * *, #, a-d, and A-D are also supported in addition to the numeric characters 0-9. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = SendDtmf.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class SendDtmf implements Verb { + /** + * + * @param digits (str): String containing the DTMF characters to be sent in a call. Allows a maximum of 50 characters. The digits will be sent one-by-one with a marginal delay. + * @param toneDuration (int, optional): The length (in milliseconds) of each DTMF tone. Default value is 200. Range: decimal values between 50 - 5000. + * @param toneInterval (int, optional): The duration of silence (in milliseconds) following each DTMF tone. Default value is 400. Range: decimal values between 50 - 5000. + * + */ + + public static final String TYPE_NAME = "SendDtmf"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String digits; + + @XmlAttribute + @Default + protected Integer toneDuration = 200; + + @XmlAttribute + @Default + protected Integer toneInterval = 400; + + public SendDtmf(String digits) { + this.digits = digits; + this.toneDuration = 200; + this.toneInterval = 400; + } + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/SipUri.java b/src/main/java/com/bandwidth/sdk/model/bxml/SipUri.java new file mode 100644 index 00000000..7094288a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/SipUri.java @@ -0,0 +1,96 @@ +/** + * The {@code } verb is used within the tag to define the called parties. Between 1 and 8 {@code }or {@code }tags must be nested + * If more than one destination is specified, called parties will ring simultaneously and the first to answer will be bridged to the original call. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = SipUri.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class SipUri implements OutboundDestination { + /** + * + * @param uri (str): A SIP URI to transfer the call to (e.g. sip:user@server.com) + * @param uui (str, optional): he value of the User-To-User header to send within the initial INVITE. Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. + * This value, including the encoding specifier, may not exceed 256 characters. Defaults to None. + * @param number (str): A phone number to transfer the call to. Value must be in E.164 format (e.g. +15555555555). + * @param transferAnswerUrl (str, optional): URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged. May be a relative URL. Defaults to None. + * @param transferAnswerMethod (str, optional): The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. Defaults to None. + * @param transferAnswerFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Transfer Answer callback delivery in case transferAnswerUrl fails to respond. Defaults to None. + * @param transferAnswerFallbackMethod (str, optional): The HTTP method to use to deliver the Transfer Answer callback to transferAnswerFallbackUrl. GET or POST. Default value is POST. Defaults to None. + * @param transferDisconnectUrl (str, optional): URL, if any, to send the Transfer Disconnect event to. This event will be sent regardless of how the transfer ends and may not be responded to with BXML. May be a relative URL. Defaults to None. + * @param transferDisconnectMethod (str, optional): The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. Defaults to Defaults to Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. Defaults to Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to transferAnswerFallbackUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None. + * + */ + + public static final String TYPE_NAME = "SipUri"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String uri; + + @XmlAttribute + protected String uui; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + protected String transferAnswerUrl; + + @XmlAttribute + @Default + protected String transferAnswerMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String transferAnswerFallbackUrl; + + @XmlAttribute + @Default + protected String transferAnswerFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String transferDisconnectUrl; + + @XmlAttribute + @Default + protected String transferDisconnectMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String tag; +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/SpeakSentence.java b/src/main/java/com/bandwidth/sdk/model/bxml/SpeakSentence.java new file mode 100644 index 00000000..755e26f7 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/SpeakSentence.java @@ -0,0 +1,79 @@ +/** + * The {@code } verb is used to play speech audio on the call. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAnyElement; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlMixed; +import jakarta.xml.bind.annotation.XmlType; +import java.util.List; + +import com.bandwidth.sdk.model.bxml.utils.TtsGender; +import com.bandwidth.sdk.model.bxml.utils.TtsLocale; +import com.bandwidth.sdk.model.bxml.utils.TtsVoice; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = SpeakSentence.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class SpeakSentence implements AudioProducer { + /** + * + * @param text (str): The text to speak. Cannot be blank. Can be a mixture of plain text and SSML tags. + * You can find a list of supported SSML tags here: https://dev.bandwidth.com/docs/voice/bxml/speakSentence/#supported-ssml-tags + * @param voice (str, optional): Selects the voice of the speaker. Consult the voice column in the below table for valid values. + * If the voice attribute is present, gender and locale are ignored. You can find a list of supported voices here: https://dev.bandwidth.com/docs/voice/bxml/speakSentence/#supported-voices + * @param gender (str, optional): Selects the gender of the speaker. Valid values are "male" or "female". Default "female". + * @param locale (str, optional): Selects the locale of the speaker. Consult the locale column in the below table for valid values. Default "en_US" + * + */ + + public static final String TYPE_NAME = "SpeakSentence"; + + @XmlMixed + @XmlAnyElement + protected List innerTags; + + @XmlAttribute + @Default + protected TtsGender gender = TtsGender.FEMALE; + + @XmlAttribute + @Default + protected TtsLocale locale = TtsLocale.EN_US; + + @XmlAttribute + protected TtsVoice voice; + + public SpeakSentence(String text) { + this.innerTags = List.of(text); + this.gender = TtsGender.FEMALE; + this.locale = TtsLocale.EN_US; + } + + public SpeakSentence(String text, TtsGender gender, TtsLocale locale, TtsVoice voice) { + this.innerTags = List.of(text); + this.gender = gender; + this.locale = locale; + this.voice = voice; + } + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartGather.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartGather.java new file mode 100644 index 00000000..be5e11d6 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartGather.java @@ -0,0 +1,61 @@ +/** + * The {@code } verb is used to get asynchronous notifications of DTMF digits collected in the call while other verbs are executed. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StartGather.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StartGather implements Verb { + /** + * + * @param dtmfUrl (str): URL to send the DTMF event to. May be a relative URL.. + * @param dtmfMethod (str, optional): The HTTP method to use for the request to dtmfUrl. GET or POST. Default value is POST. Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to dtmfUrl. Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to dtmfUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None. + * + */ + + public static final String TYPE_NAME = "StartGather"; + + @XmlAttribute + @Getter + protected String dtmfUrl; + + @XmlAttribute + @Default + protected String dtmfMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String tag; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java new file mode 100644 index 00000000..d770855f --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java @@ -0,0 +1,83 @@ +/** + * The {@code } verb allows a segment of a call or conference to be recorded while other verbs are executing. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_RECORD_AUDIO_FORMAT; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StartRecording.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StartRecording implements TranscriptionProducer { + /** + * + * @param recordingAvailableUrl (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. + * @param recordingAvailableMethod (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. + * @param transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + * @param transcriptionAvailableUrl (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. + * @param transcriptionAvailableMethod (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. + * @param fileFormat (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. max_duration (str, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. + * @param multiChannel (str, optional): A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false. + * + */ + + public static final String TYPE_NAME = "StartRecording"; + + @XmlAttribute + protected String recordingAvailableUrl; + + @XmlAttribute + @Default + protected String recordingAvailableMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected Boolean transcribe; + + @XmlAttribute + protected String transcriptionAvailableUrl; + + @XmlAttribute + protected String transcriptionAvailableMethod; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String tag; + + @XmlAttribute + @Default + protected String fileFormat = DEFAULT_RECORD_AUDIO_FORMAT; + + @XmlAttribute + @Default + protected Boolean multiChannel = false; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java new file mode 100644 index 00000000..0735c5ab --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java @@ -0,0 +1,86 @@ +/** + * The {@code } verb allows a segment of a call to be sent off to another destination for additional processing. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlType; +import java.util.List; +import java.util.UUID; + +import com.bandwidth.sdk.model.CallDirectionEnum; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StartStream.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StartStream implements Verb { + /** + * + * @param name (str, optional): A name to refer to this stream by. Used when sending . If not provided, it will default to the generated stream id as sent in the Media Stream Started webhook. + * @param tracks (str, optional): The part of the call to send a stream from. inbound, outbound or both. Default is inbound. + * @param destination (str, optional): A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL as base64-encoded PCMU/G711 audio. See below for more details on the websocket packet format. + * @param streamEventUrl (str, optional): URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. + * @param streamEventMethod (str, optional): The HTTP method to use for the request to streamEventUrl. GET or POST. Default value is POST. + * @param username (str, optional): The username to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). + * @param password (str, optional): The password to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). + * + * Nested Verbs: + * @param StreamParam: (optional) You may specify up to 12 elements nested within a tag. + * These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started. + * + */ + + public static final String TYPE_NAME = "StartStream"; + + @XmlAttribute + protected String name; + + @XmlAttribute + @Default + protected CallDirectionEnum tracks = CallDirectionEnum.INBOUND; + + @XmlAttribute + protected String destination; + + @XmlAttribute + @Getter + protected String streamEventUrl; + + @XmlAttribute + @Default + protected String streamEventMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlElements({ + @XmlElement(name = StreamParam.TYPE_NAME, type = StreamParam.class) + }) + protected List streamParams; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java new file mode 100644 index 00000000..52c8e600 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java @@ -0,0 +1,90 @@ +/** + * The {@code } verb allows a segment of a call to be transcribed and optionally for the live transcription to be sent off to another destination for additional processing. + */ + +package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlType; +import java.util.List; +import java.util.UUID; + +import com.bandwidth.sdk.model.CallDirectionEnum; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StartTranscription.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StartTranscription implements Verb { + /** + * + * @param name (str, optional): A name to refer to this transcription by. Used when sending . If not provided, it will default to the generated transcription id as sent in the Real-Time Transcription Started webhook. + * @param tracks (str, optional): The part of the call to send a transcription from. inbound, outbound or both. Default is inbound. + * @param destination (str, optional): A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL as base64-encoded PCMU/G711 audio. See below for more details on the websocket packet format. + * @param transcriptionEventUrl (str, optional): URL to send the associated Webhook events to during this real-time transcription's lifetime. Does not accept BXML. May be a relative URL. + * @param transcriptionEventMethod (str, optional): The HTTP method to use for the request to transcriptionEventUrl. GET or POST. Default value is POST. + * @param username (str, optional): The username to send in the HTTP request to transcriptionEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). + * @param password (str, optional): The password to send in the HTTP request to transcriptionEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). + * @param stabilized (str, optional): Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. + * + * Nested Verbs: + * @param CustomParam: (optional) You may specify up to 12 elements nested within a tag. + * These elements define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started. + * + */ + + public static final String TYPE_NAME = "StartTranscription"; + + @XmlAttribute + protected String name; + + @XmlAttribute + @Default + protected CallDirectionEnum tracks = CallDirectionEnum.INBOUND; + + @XmlAttribute + protected String destination; + + @XmlAttribute + @Getter + protected String transcriptionEventUrl; + + @XmlAttribute + @Default + protected String transcriptionEventMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected Boolean stabilized = true; + + @XmlElements({ + @XmlElement(name = CustomParam.TYPE_NAME, type = CustomParam.class) + }) + protected List customParams; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StopGather.java b/src/main/java/com/bandwidth/sdk/model/bxml/StopGather.java new file mode 100644 index 00000000..35c52299 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StopGather.java @@ -0,0 +1,25 @@ +/** + * The {@code } verb is used to stop the DTMF detection that was previously started by a {@code } verb. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlType; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StopGather.TYPE_NAME) +@NoArgsConstructor +@EqualsAndHashCode +public class StopGather implements Verb { + + public static final String TYPE_NAME = "StopGather"; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StopRecording.java b/src/main/java/com/bandwidth/sdk/model/bxml/StopRecording.java new file mode 100644 index 00000000..900e4d70 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StopRecording.java @@ -0,0 +1,22 @@ +/** + * The {@code } verb is used to stop a recording that was previously started by a {@code } verb. + */ + +package com.bandwidth.sdk.model.bxml; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@Getter +@EqualsAndHashCode +public class StopRecording implements Verb { + + public static final String TYPE_NAME = "StopRecording"; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StopStream.java b/src/main/java/com/bandwidth/sdk/model/bxml/StopStream.java new file mode 100644 index 00000000..9fd6b7ab --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StopStream.java @@ -0,0 +1,40 @@ +/** + * The {@code } verb is used to stop a stream that was started with a previous {@code } verb. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StopStream.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StopStream implements Verb { + /** + * + * @param name (str, optional): The name of the stream to stop. + * This is either the user selected name when sending the verb, or the system generated name returned in the Media Stream Started webhook if was sent with no name attribute. + */ + + public static final String TYPE_NAME = "StopStream"; + + @XmlAttribute + protected String name; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StopTranscription.java b/src/main/java/com/bandwidth/sdk/model/bxml/StopTranscription.java new file mode 100644 index 00000000..51435bfd --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StopTranscription.java @@ -0,0 +1,40 @@ +/** + * The {@code } verb is used to stop a real-time transcription that was started with a previous {@code } verb. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = StopTranscription.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class StopTranscription implements Verb { + /** + * + * @param name (str, optional): The name of the real-time transcription to stop. + * This is either the user selected name when sending the verb, or the system generated name returned in the Media Transcription Started webhook if was sent with no name attribute. + */ + + public static final String TYPE_NAME = "StopTranscription"; + + @XmlAttribute + protected String name; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StreamParam.java b/src/main/java/com/bandwidth/sdk/model/bxml/StreamParam.java new file mode 100644 index 00000000..65961730 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StreamParam.java @@ -0,0 +1,37 @@ +/** + * The {@code } verb is used to define optional user specified parameters that will be sent to the destination URL when the stream is first started. + * You may specify up to 12 {@code } elements nested within a {@code } tag. + */ + +package com.bandwidth.sdk.model.bxml; + + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlType; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@XmlType(name = StreamParam.TYPE_NAME) +@XmlAccessorType(XmlAccessType.FIELD) +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StreamParam { + /** + * + * @param name (str): The name of this parameter, up to 256 characters. + * @param value (str): The value of this parameter, up to 2048 characters. + * + */ + public static final String TYPE_NAME = "StreamParam"; + + @XmlAttribute + protected String name; + @XmlAttribute + protected String value; +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Tag.java b/src/main/java/com/bandwidth/sdk/model/bxml/Tag.java new file mode 100644 index 00000000..1752210a --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Tag.java @@ -0,0 +1,44 @@ +/** + * The {@code } verb is used to set a new tag value without executing a callback. + * This new tag will be sent with all future callbacks unless overwritten by a future tag attribute or {@code } verb, or cleared. + */ + +package com.bandwidth.sdk.model.bxml; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.XmlValue; +import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Tag.TYPE_NAME) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Getter +@EqualsAndHashCode +public class Tag implements Verb { + /** + * + * @param tag (str, optional): Custom tag value. Defaults to "". + * + */ + + public static final String TYPE_NAME = "Tag"; + + @XmlValue + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String tag; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/TranscriptionProducer.java b/src/main/java/com/bandwidth/sdk/model/bxml/TranscriptionProducer.java new file mode 100644 index 00000000..ced404eb --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/TranscriptionProducer.java @@ -0,0 +1,15 @@ +package com.bandwidth.sdk.model.bxml; + +import com.fasterxml.jackson.annotation.JsonSubTypes; + +@JsonSubTypes({ + @JsonSubTypes.Type(value = Record.class, name = Record.TYPE_NAME), + @JsonSubTypes.Type(value = StartRecording.class, name = StartRecording.TYPE_NAME), +}) +public interface TranscriptionProducer extends Verb { + Boolean getTranscribe(); + + String getTranscriptionAvailableUrl(); + + String getTranscriptionAvailableMethod(); +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java b/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java new file mode 100644 index 00000000..787e7be0 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java @@ -0,0 +1,131 @@ +/** + * The {@code } verb is used to transfer a party onto an existing call. + */ + + package com.bandwidth.sdk.model.bxml; + +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD; +import static com.bandwidth.sdk.model.bxml.utils.BxmlConstants.DEFAULT_CALL_TIMEOUT; + +import com.bandwidth.sdk.model.DiversionReason; +import com.bandwidth.sdk.model.DiversionTreatment; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElements; +import jakarta.xml.bind.annotation.XmlType; +import java.net.URI; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Builder.Default; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = Transfer.TYPE_NAME) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Getter +@EqualsAndHashCode +public class Transfer implements Verb { + /** + * + * @param destinations (list[PhoneNumber, SipUri], optional): List of recipients to transfer a call to. Defaults to []. + * @param transferCallerId (str, optional): The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555) or be one of the following strings Restricted, Anonymous, Private, or Unavailable. Leave as default to pass along the number of the remote party. Defaults to None. + * @param callTimeout (double, optional):The timeout (in seconds) for the callee to answer the call after it starts ringing. If the call does not start ringing within 30s, the call will be cancelled regardless of this value. Range: decimal values between 1 - 300. Default value is 30 seconds. Defaults to None. + * @param transferCompleteUrl (str, optional): URL to send the Transfer Complete event to and request new BXML. Optional but recommended. See below for further details. May be a relative URL. Defaults to None. + * @param transferCompleteMethod (str, optional): The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Defaults to None. + * @param transferCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Transfer Complete callback delivery in case transferCompleteUrl fails to respond. Defaults to None. + * @param transferCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Transfer Complete callback to transferCompleteFallbackUrl. GET or POST. Default value is POST. Defaults to None. + * @param username (str, optional): The username to send in the HTTP request to transferCompleteUrl. Defaults to None. + * @param password (str, optional): The password to send in the HTTP request to transferCompleteUrl. Defaults to None. + * @param fallbackUsername (str, optional): The username to send in the HTTP request to transferCompleteFallbackUrl. Defaults to None. + * @param fallbackPassword (str, optional): The password to send in the HTTP request to transferCompleteFallbackUrl. Defaults to None. + * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="" Max length 256 characters. Defaults to None. + * @param diversionTreatment (str, optional): Can be any of the following: + * none: No diversion headers are sent on the outbound leg of the transferred call. + * propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. + * stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. + * Defaults to none. If diversionTreatment is not specified, no diversion header will be included for the transfer even if one came with the inbound call. Defaults to None. + * @param diversionReason (str, optional): Can be any of the following values: + * unknown + * user-busy + * no-answer + * unavailable + * unconditional + * time-of-day + * do-not-disturb + * deflection + * follow-me + * out-of-service + * away + * + * This parameter is considered only when diversionTreatment is set to stack. Defaults is unknown. + * Defaults to None. + * + */ + + public static final String TYPE_NAME = "Transfer"; + + @XmlElements({ + @XmlElement(name = PhoneNumber.TYPE_NAME, type = PhoneNumber.class), + @XmlElement(name = SipUri.TYPE_NAME, type = SipUri.class) + }) + protected List destinations; + + @XmlAttribute + protected String transferCallerId; + + /** + * Call timeout in seconds. + */ + @XmlAttribute + @Default + protected Double callTimeout = DEFAULT_CALL_TIMEOUT; + + @XmlAttribute + protected String username; + + @XmlAttribute + protected String password; + + @XmlAttribute + protected String fallbackUsername; + + @XmlAttribute + protected String fallbackPassword; + + @XmlAttribute + protected URI transferCompleteUrl; + + @XmlAttribute + @Default + protected String transferCompleteMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected URI transferCompleteFallbackUrl; + + @XmlAttribute + @Default + protected String transferCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD; + + @XmlAttribute + protected String tag; + + @XmlAttribute + @Default + protected DiversionTreatment diversionTreatment = DiversionTreatment.NONE; + + @XmlAttribute + @Default + protected DiversionReason diversionReason = DiversionReason.UNKNOWN; + + @Override + public String getVerbName() { + return TYPE_NAME; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Verb.java b/src/main/java/com/bandwidth/sdk/model/bxml/Verb.java new file mode 100644 index 00000000..aef59e07 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Verb.java @@ -0,0 +1,5 @@ +package com.bandwidth.sdk.model.bxml; + +public interface Verb { + String getVerbName(); +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/utils/BxmlConstants.java b/src/main/java/com/bandwidth/sdk/model/bxml/utils/BxmlConstants.java new file mode 100644 index 00000000..a4ce6b78 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/utils/BxmlConstants.java @@ -0,0 +1,17 @@ +package com.bandwidth.sdk.model.bxml.utils; + +public final class BxmlConstants { + + public static final String DEFAULT_EMPTY_STRING = ""; + public static final String DEFAULT_CALLBACK_METHOD = "POST"; + public static final String DEFAULT_RECORD_AUDIO_FORMAT = "wav"; + public static final Integer DEFAULT_RECORD_MAX_DURATION = 60; + public static final Double DEFAULT_RECORD_SILENCE_TIMEOUT = 0d; + public static final String DEFAULT_TERMINATING_DIGITS = "#"; + public static final Double DEFAULT_CALL_TIMEOUT = 300d; + public static final Double DEFAULT_FIRSTDIGIT_TIMEOUT = 5d; + public static final Double DEFAULT_INTERDIGIT_TIMEOUT = 5d; + public static final Double DEFAULT_PAUSE_DURATION = 2d; + public static final Integer DEFAULT_MAX_DIGITS = 50; + public static final Integer DEFAULT_REPEAT_COUNT = 1; +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/utils/EnumFinder.java b/src/main/java/com/bandwidth/sdk/model/bxml/utils/EnumFinder.java new file mode 100644 index 00000000..faaf73bf --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/utils/EnumFinder.java @@ -0,0 +1,70 @@ +package com.bandwidth.sdk.model.bxml.utils; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.function.Predicate; + +/** + * Allows for convenient finding of enums based on custom enum fields. + * + * @param the type of the enum + */ +public class EnumFinder> { + + private final List enums; + + public EnumFinder(Class enumClass) { + this.enums = Arrays.asList(enumClass.getEnumConstants()); + } + + /** + * Finds an {@code Optional} enum based on a {@code Predicate}. + *

Example: {@code find(thing -> thing.code == code)}

+ * Note: Finds the first enum that matches the predicate using the order the enums are declared in. + * + * @param predicate the predicate to match the enum against + * @return the {@code Optional} enum matching the predicate + */ + public Optional findOptional(Predicate predicate) { + return enums.stream().filter(predicate).findFirst(); + } + + /** + * Finds an enum based on a {@code Predicate} that must match otherwise an {@code IllegalArgumentException} will be + * thrown. + * + * @param predicate the predicate to match the enum against + * @return the enum matching the predicate + * @throws IllegalArgumentException thrown if predicate doesn't match + * @see #find(Predicate) + * @see #findOptional(Predicate) + */ + public E findRequired(Predicate predicate) { + return findOptional(predicate).orElseThrow(IllegalArgumentException::new); + } + + /** + * Finds an enum based on a {@code Predicate}. + * + * @param predicate the predicate to match the enum against + * @return the enum matching the predicate, {@code null} if no match + * @see #findRequired(Predicate) + * @see #findOptional(Predicate) + */ + public E find(Predicate predicate) { + return findOptional(predicate).orElse(null); + } + + /** + * Convenience method to create an enum finder with less generics mess. + * + *

{@code AnEnum anEnum = EnumFinder.of(AnEnum.class).find(e -> e.code == code).orElse(null)} + * + * @param enumClass the type of the enum + * @return the enum finder + */ + public static > EnumFinder of(Class enumClass) { + return new EnumFinder<>(enumClass); + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsGender.java b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsGender.java new file mode 100644 index 00000000..eaeff428 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsGender.java @@ -0,0 +1,26 @@ +package com.bandwidth.sdk.model.bxml.utils; + +import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; + +@XmlEnum +public enum TtsGender { + @XmlEnumValue("female") FEMALE("female"), + @XmlEnumValue("male") MALE("male"); + + private final String genderString; + + TtsGender(String genderString) { + this.genderString = genderString; + } + + @JsonCreator + public static TtsGender resolve(String gender) { + return EnumFinder.of(TtsGender.class).find(g -> g.genderString.equals(gender)); + } + + public String toString() { + return genderString; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsLocale.java b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsLocale.java new file mode 100644 index 00000000..d6dbac66 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsLocale.java @@ -0,0 +1,37 @@ +package com.bandwidth.sdk.model.bxml.utils; + +import com.fasterxml.jackson.annotation.JsonCreator; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; + +@XmlEnum +public enum TtsLocale { + @XmlEnumValue("en_US") EN_US("en_US"), + @XmlEnumValue("en_UK") EN_UK("en_UK"), + @XmlEnumValue("de") DE("de"), + @XmlEnumValue("es") ES("es"), + @XmlEnumValue("es_MX") ES_MX("es_MX"), + @XmlEnumValue("fr") FR("fr"), + @XmlEnumValue("it") IT("it"), + @XmlEnumValue("ru") RU("ru"), + @XmlEnumValue("ja") JA("ja"), + @XmlEnumValue("arb") ARB("arb"), + @XmlEnumValue("cmn-CN") CMN_CN("cmn-CN"); + + private final String locale; + + TtsLocale(String locale) { + this.locale = locale; + } + + @JsonCreator + public static TtsLocale resolve(String localeString) { + return EnumFinder.of(TtsLocale.class) + .find(loc -> loc.locale.equals(localeString)); + } + + public String toString() { + return locale; + } +} diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsVoice.java b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsVoice.java new file mode 100644 index 00000000..b6f8492d --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/bxml/utils/TtsVoice.java @@ -0,0 +1,93 @@ +package com.bandwidth.sdk.model.bxml.utils; + +import static com.bandwidth.sdk.model.bxml.utils.TtsGender.FEMALE; +import static com.bandwidth.sdk.model.bxml.utils.TtsGender.MALE; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.ARB; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.CMN_CN; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.DE; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.EN_UK; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.EN_US; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.ES; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.ES_MX; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.FR; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.IT; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.JA; +import static com.bandwidth.sdk.model.bxml.utils.TtsLocale.RU; + +import com.fasterxml.jackson.annotation.JsonCreator; +import jakarta.xml.bind.annotation.XmlEnumValue; + +public enum TtsVoice { + + // The enum declaration order is the order in which the enums are searched by EnumFinder + // This establishes priority, as voices with the same locale and gender that are higher on the list + // are reached and returned first when searching with resolveGenderLocale() + @XmlEnumValue("susan") SUSAN(EN_US, FEMALE, "susan", "Kimberly"), + @XmlEnumValue("paul") PAUL(EN_US, MALE, "paul", "Matthew"), + @XmlEnumValue("julie") JULIE(EN_US, FEMALE, "julie", "Joanna"), + @XmlEnumValue("kate") KATE(EN_US, FEMALE, "kate", "Kendra"), + @XmlEnumValue("bridget") BRIDGET(EN_UK, FEMALE, "bridget", "Amy"), + @XmlEnumValue("katrin") KATRIN(DE, FEMALE, "katrin", "Marlene"), + @XmlEnumValue("esperanza") ESPERANZA(ES, FEMALE, "esperanza", "Conchita"), + @XmlEnumValue("violeta") VIOLETA(ES, FEMALE, "violeta", "Lucia"), + @XmlEnumValue("rosa") ROSA(ES_MX, FEMALE, "rosa", "Mia"), + @XmlEnumValue("jolie") JOLIE(FR, FEMALE, "jolie", "Celine"), + @XmlEnumValue("paola") PAOLA(IT, FEMALE, "paola", "Carla"), + @XmlEnumValue("nadiya") NADIYA(RU, FEMALE, "nadiya", "Tatyana"), + @XmlEnumValue("masako") MASAKO(JA, FEMALE, "masako", "Mizuki"), + @XmlEnumValue("zeina") ZEINA(ARB, FEMALE, "zeina", "Zeina"), + @XmlEnumValue("zhiyu") ZHIYU(CMN_CN, FEMALE, "zhiyu", "Zhiyu"), + @XmlEnumValue("dave") DAVE(EN_US, MALE, "dave", "Matthew"), + @XmlEnumValue("simon") SIMON(EN_UK, MALE, "simon", "Brian"), + @XmlEnumValue("stefan") STEFAN(DE, MALE, "stefan", "Hans"), + @XmlEnumValue("jorge") JORGE(ES, MALE, "jorge", "Enrique"), + @XmlEnumValue("bernard") BERNARD(FR, MALE, "bernard", "Mathieu"), + @XmlEnumValue("luca") LUCA(IT, MALE, "luca", "Giorgio"), + @XmlEnumValue("anatoli") ANATOLI(RU, MALE, "anatoli", "Maxim"), + @XmlEnumValue("kenji") KENJI(JA, MALE, "kenji", "Takumi"); + + + private final TtsLocale locale; + private final TtsGender gender; + + /** + * What we present this voice as to our customers. + */ + private final String ourName; + + /** + * What our TTS provider calls this voice. + */ + private final String providerName; + + TtsVoice(TtsLocale locale, TtsGender gender, String ourName, String providerName) { + this.locale = locale; + this.gender = gender; + this.ourName = ourName; + this.providerName = providerName; + } + + public String getProviderName() { + return providerName; + } + + @JsonCreator + public static TtsVoice fromOurName(String ourName) { + return EnumFinder.of(TtsVoice.class).find(e -> e.ourName.equals(ourName)); + } + + public static TtsVoice resolveGenderLocale(TtsGender gender, TtsLocale locale) { + TtsVoice voice = EnumFinder.of(TtsVoice.class) + .find(e -> e.locale == locale && e.gender == gender); + if (null == voice) { + return EnumFinder.of(TtsVoice.class) + .find(e -> e.locale == locale); + } + return voice; + } + + @Override + public String toString() { + return this.ourName; + } +} diff --git a/src/main/java/com/bandwidth/utilities/FileWrapper.java b/src/main/java/com/bandwidth/utilities/FileWrapper.java deleted file mode 100644 index 3a24f1f4..00000000 --- a/src/main/java/com/bandwidth/utilities/FileWrapper.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.utilities; - -import com.fasterxml.jackson.annotation.JsonInclude; -import java.io.File; -import java.io.FileInputStream; - -/** - * Class to wrap file and contentType to be sent as part of a HTTP request. - */ -public class FileWrapper { - - @JsonInclude(JsonInclude.Include.NON_ABSENT) - private File file; - @JsonInclude(JsonInclude.Include.NON_ABSENT) - private byte[] fileStream; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String contentType; - - /** - * Initialization constructor. - * @param file File object to be wrapped - * @param contentType content type of file - */ - public FileWrapper(File file, String contentType) { - this.file = file; - this.fileStream = null; - this.contentType = contentType; - } - /** - * Initialization constructor. - * @param fileStream File Input Stream object to be wrapped - * @param contentType content type of file - */ - public FileWrapper(byte[] fileStream, String contentType) { - this.file = null; - this.fileStream = fileStream; - this.contentType = contentType; - } - - /** - * Initialization constructor. - * @param file File object to be wrapped - */ - public FileWrapper(File file) { - this.file = file; - } - - /** - * Initialization constructor. - * @param fileStream File object to be wrapped - */ - public FileWrapper(byte[] fileStream) { - this.fileStream = fileStream; - } - - /** - * Getter for file. - * @return File instance - */ - public File getFile() { return file; } - - /** - * Getter for fileStream. - * @return byte[] instance - */ - public byte[] getFileStream() { return fileStream; } - - /** - * Getter for content type. - * @return content type of the file - */ - public String getContentType() { - return contentType; - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/AudioProducer.java b/src/main/java/com/bandwidth/voice/bxml/verbs/AudioProducer.java deleted file mode 100644 index a340845b..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/AudioProducer.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -/** - * Produces Audio in the Verb. - */ -public interface AudioProducer { - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Bridge.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Bridge.java deleted file mode 100644 index becb4a3e..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Bridge.java +++ /dev/null @@ -1,210 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - -import lombok.Builder; - -/** - * The Bridge verb is used to bridge another party (target call) onto the current call. - * When the target call is bridged, any BXML being executed in it will be cancelled. - * The bridge ends when one of the calls leaves the bridge. A call leaves the bridge when it is hung up or when it gets redirected to another BXML. - * The Bridge Complete and Bridge Target Complete callbacks are sent when the bridge ends, to allow the call that remained in the bridge to execute new BXML. - * - *@author bandwidth - */ -@Builder -@XmlType(name = Bridge.TYPE_NAME) -public class Bridge implements Verb { - - public static final String TYPE_NAME = "Bridge"; - - /** - * String containing the callId of the call to be bridged. - */ - @XmlValue - private String callId; - - @XmlAttribute - private URI bridgeCompleteFallbackUrl; - - @XmlAttribute - private Method bridgeCompleteFallbackMethod; - - - @XmlAttribute - private URI bridgeTargetCompleteFallbackUrl; - - - @XmlAttribute - private Method bridgeTargetCompleteFallbackMethod; - - - @XmlAttribute - private String fallbackUsername; - - - @XmlAttribute - private String fallbackPassword; - - - - /** - * (optional) URL to send the Bridge Complete event to and request new BXML. - * If this attribute is specified, then Verbs following the verb will be ignored and the BXML returned in this callback is executed on the call. - * If this attribute is not specified then no callback will be sent, and execution of the verbs following the verb continues. - */ - @XmlAttribute - private URI bridgeCompleteUrl; - - /** - * (optional) he HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method bridgeCompleteMethod; - - /** - * (optional) URL to send the Bridge Target Complete event to and request new BXML. If this attribute is specified, then the BXML returned in this callback is executed on the target call. - * If this attribute is not specified then no callback will be sent, and the target call will be hung up. - */ - @XmlAttribute - private URI bridgeTargetCompleteUrl; - - /** - * (optional) he HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method bridgeTargetCompleteMethod; - - /** - * username to authenticate at the bridgeCompleteUrl & bridgeTargetCompleteUrl endpoints - */ - @XmlAttribute - protected String username; - - /** - * password to use to authenticate at the bridgeCompleteUrl & bridgeTargetCompleteUrl endpoints - */ - @XmlAttribute - protected String password; - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - public static class BridgeBuilder{ - - /** - * (optional) URL to send the Bridge Complete event to and request new BXML. - * If this attribute is specified, then Verbs following the verb will be ignored and the BXML returned in this callback is executed on the call. - * If this attribute is not specified then no callback will be sent, and execution of the verbs following the verb continues. - */ - public BridgeBuilder bridgeCompleteUrl(String url){ - return this.bridgeCompleteUrl(URI.create(url)); - } - - /** - * (optional) URL to send the Bridge Complete event to and request new BXML. - * If this attribute is specified, then Verbs following the verb will be ignored and the BXML returned in this callback is executed on the call. - * If this attribute is not specified then no callback will be sent, and execution of the verbs following the verb continues. - */ - public BridgeBuilder bridgeCompleteUrl(URI url){ - this.bridgeCompleteUrl = url; - return this; - } - - - public BridgeBuilder bridgeCompleteFallbackUrl(String url){ - return this.bridgeCompleteFallbackUrl(URI.create(url)); - } - - public BridgeBuilder bridgeCompleteFallbackUrl(URI url){ - this.bridgeCompleteFallbackUrl = url; - return this; - } - - public BridgeBuilder bridgeCompleteFallbackMethod(String method){ - return this.bridgeCompleteFallbackMethod(Method.fromValue(method)); - } - - public BridgeBuilder bridgeCompleteFallbackMethod(Method method){ - this.bridgeCompleteFallbackMethod = method; - return this; - } - - public BridgeBuilder bridgeTargetCompleteFallbackUrl(String url){ - return this.bridgeTargetCompleteFallbackUrl(URI.create(url)); - } - - public BridgeBuilder bridgeTargetCompleteFallbackUrl(URI url){ - this.bridgeTargetCompleteFallbackUrl = url; - return this; - } - - public BridgeBuilder bridgeTargetCompleteFallbackMethod(String method){ - return this.bridgeTargetCompleteFallbackMethod(Method.fromValue(method)); - } - - public BridgeBuilder bridgeTargetCompleteFallbackMethod(Method method){ - this.bridgeTargetCompleteFallbackMethod = method; - return this; - } - - /** - * (optional) he HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST. Converts String to Method using Method.fromValue(method) - */ - public BridgeBuilder bridgeCompleteMethod(String method){ - return this.bridgeCompleteMethod(Method.fromValue(method)); - } - - /** - * (optional) he HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST. - */ - public BridgeBuilder bridgeCompleteMethod(Method method){ - this.bridgeCompleteMethod = method; - return this; - } - - /** - * (optional) URL to send the Bridge Target Complete event to and request new BXML. If this attribute is specified, then the BXML returned in this callback is executed on the target call. - * If this attribute is not specified then no callback will be sent, and the target call will be hung up. - */ - public BridgeBuilder bridgeTargetCompleteUrl(String url){ - return this.bridgeTargetCompleteUrl(URI.create(url)); - } - - /** - * (optional) URL to send the Bridge Target Complete event to and request new BXML. If this attribute is specified, then the BXML returned in this callback is executed on the target call. - * If this attribute is not specified then no callback will be sent, and the target call will be hung up. - */ - public BridgeBuilder bridgeTargetCompleteUrl(URI url){ - this.bridgeTargetCompleteUrl = url; - return this; - } - - - /** - * (optional) he HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST. Converts String to Method using Method.fromValue(method) - */ - public BridgeBuilder bridgeTargetCompleteMethod(String method){ - return this.bridgeTargetCompleteMethod(Method.fromValue(method)); - } - - /** - * (optional) he HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST. - */ - public BridgeBuilder bridgeTargetCompleteMethod(Method method){ - this.bridgeTargetCompleteMethod = method; - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Bxml.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Bxml.java deleted file mode 100644 index ce1631a7..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Bxml.java +++ /dev/null @@ -1,138 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElements; -import javax.xml.bind.annotation.XmlRootElement; - -@Builder -@XmlRootElement(name = Bxml.TYPE_NAME) -public class Bxml { - public static final String TYPE_NAME = "Bxml"; - - private static JAXBContext jaxbContext; - - @XmlElements({ - @XmlElement(name = Gather.TYPE_NAME, type = Gather.class), - @XmlElement(name = Hangup.TYPE_NAME, type = Hangup.class), - @XmlElement(name = Redirect.TYPE_NAME, type = Redirect.class), - @XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class), - @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class), - @XmlElement(name = Transfer.TYPE_NAME, type = Transfer.class), - @XmlElement(name = Pause.TYPE_NAME, type = Pause.class), - @XmlElement(name = Forward.TYPE_NAME, type = Forward.class), - @XmlElement(name = SendDtmf.TYPE_NAME, type = SendDtmf.class), - @XmlElement(name = Record.TYPE_NAME, type = Record.class), - @XmlElement(name = StartRecording.TYPE_NAME, type = StartRecording.class), - @XmlElement(name = StopRecording.TYPE_NAME, type = StopRecording.class), - @XmlElement(name = PauseRecording.TYPE_NAME, type = PauseRecording.class), - @XmlElement(name = ResumeRecording.TYPE_NAME, type = ResumeRecording.class), - @XmlElement(name = Conference.TYPE_NAME, type = Conference.class), - @XmlElement(name = Bridge.TYPE_NAME, type = Bridge.class), - @XmlElement(name = Ring.TYPE_NAME, type = Ring.class), - @XmlElement(name = StartGather.TYPE_NAME, type = StartGather.class), - @XmlElement(name = StopGather.TYPE_NAME, type = StopGather.class), - @XmlElement(name = Tag.TYPE_NAME, type = Tag.class), - @XmlElement(name = SipUri.TYPE_NAME, type = SipUri.class), - @XmlElement(name = StartStream.TYPE_NAME, type = StartStream.class), - @XmlElement(name = StopStream.TYPE_NAME, type = StopStream.class), - @XmlElement(name = StreamParam.TYPE_NAME, type = StreamParam.class), - @XmlElement(name = StartTranscription.TYPE_NAME, type = StartTranscription.class), - @XmlElement(name = StopTranscription.TYPE_NAME, type = StopTranscription.class), - @XmlElement(name = CustomParam.TYPE_NAME, type = CustomParam.class), - - }) - private final List verbs = new ArrayList<>(); - - private static final Pattern XML_PATTERN = Pattern.compile("<([a-zA-Z//].*?)>"); - - private static final Pattern SPEAK_SENTENCE_PATTERN = Pattern.compile("(.*?)<\\/SpeakSentence>"); - - - - public Bxml(){ - } - - - - - /** - * Returns list of verbs in this Bxml - */ - public List getVerbs() { - return verbs; - } - - /** - * Adds a Verb to the list of Verbs in this Bxml - */ - public Bxml add(Verb verb) { - this.verbs.add(verb); - return this; - } - - /** - * Adds Verbs to the list of Verbs in this Bxml - */ - public Bxml addAll(Verb... verbs) { - this.verbs.addAll(Arrays.asList(verbs)); - return this; - } - - /** - * Convert this Bxml and its verbs into their corresponding XML and get the result as a String - * - */ - public String toBXML() { - OutputStream outputStream = new ByteArrayOutputStream(); - try { - getMarshaller().marshal(this, outputStream); - } catch (JAXBException e) { - throw new RuntimeException("Error creating BXML marshaller", e); - } - - Matcher matcherSpeakSentence = SPEAK_SENTENCE_PATTERN.matcher(outputStream.toString()); - - StringBuffer sb = new StringBuffer(); - - while(matcherSpeakSentence.find()){ - Matcher matcher = XML_PATTERN.matcher(matcherSpeakSentence.group()); - String replaced = matcher.replaceAll("<$1>").replaceAll("\\?", "\\?"); - matcherSpeakSentence.appendReplacement(sb, replaced); - } - - matcherSpeakSentence.appendTail(sb); - - return sb.toString(); - - - } - - private Marshaller getMarshaller() { - try { - // This isn't thread-unsafe, it's just expensive to create. So no locking necessary. - if (jaxbContext == null) { - jaxbContext = JAXBContext.newInstance(Bxml.class); - } - Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.setProperty("com.sun.xml.bind.xmlHeaders", ""); - marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); - - return marshaller; - } catch (JAXBException e) { - throw new RuntimeException("Error creating JAXB context for BXML serialization", e); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Conference.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Conference.java deleted file mode 100644 index 53b7fc97..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Conference.java +++ /dev/null @@ -1,160 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - -import java.util.List; - -/** - * The PlayAudio verb is used to play an audio file in the call. The URL of an audio file should be included in the body of the tag. If a relative URL is given, it is resolved relative to the endpoint that returned the BXML. - *
- * NOTE: .wav files encoded as PCM or G711 are supported. - */ -@Builder -@XmlType(name = Conference.TYPE_NAME) -public class Conference implements Verb { - - public static final String TYPE_NAME = "Conference"; - - /** - * The name of the conference with alphanumeric characters and the symbols -, _, and . with maximum length of 100 characters. - */ - @XmlValue - private String name; - - /** - * (optional) A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false - */ - @XmlAttribute - protected boolean mute; - - /** - * (optional) A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false - */ - @XmlAttribute - protected boolean hold; - - /** - * (optional) A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. - * - * Calls may be added to the conference in any order - if the matching calls are not already in the conference, then once the matching calls are added, the coach will be able to hear and speak to the matching calls. Note that this will not add the matching calls to the conference; each call must individually execute a verb to join. - * - * A conference may only have one coach. - */ - @XmlAttribute - protected String callIdsToCoach; - - /** - * (optional) URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference, and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other callback related properties like username and password), they will be ignored and the original callback information will be used. - */ - @XmlAttribute - protected URI conferenceEventUrl; - - /** - * (optional) The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - protected Method conferenceEventMethod; - - /** - * (optional) The username to send in the HTTP request to conferenceEventUrl. - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to conferenceEventUrl. - */ - @XmlAttribute - protected String password; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI conferenceEventFallbackUrl; - - @XmlAttribute - protected Method conferenceEventFallbackMethod; - - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - public static class ConferenceBuilder{ - - /** - */ - public ConferenceBuilder conferenceEventUrl(String uri){ - return this.conferenceEventUrl(URI.create(uri)); - } - - /** - */ - public ConferenceBuilder conferenceEventUrl(URI uri){ - this.conferenceEventUrl = uri; - return this; - } - - /** - * (optional) he HTTP method to use for the request to conferenceEventMethod. GET or POST. Default value is POST. Converts String to Method using Method.fromValue(method) - */ - public ConferenceBuilder conferenceEventMethod(String method){ - return this.conferenceEventMethod(Method.fromValue(method)); - } - - /** - * (optional) he HTTP method to use for the request to conferenceEventMethod. GET or POST. Default value is POST. - */ - public ConferenceBuilder conferenceEventMethod(Method method){ - this.conferenceEventMethod = method; - return this; - } - - - public ConferenceBuilder conferenceEventFallbackUrl(String uri){ - return this.conferenceEventFallbackUrl(URI.create(uri)); - } - - public ConferenceBuilder conferenceEventFallbackUrl(URI uri){ - this.conferenceEventFallbackUrl = uri; - return this; - } - - public ConferenceBuilder conferenceEventFallbackMethod(String method){ - return this.conferenceEventFallbackMethod(Method.fromValue(method)); - } - - public ConferenceBuilder conferenceEventFallbackMethod(Method method){ - this.conferenceEventFallbackMethod = method; - return this; - } - - /** - * (optional) A list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls. Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach. - * - * Calls may be added to the conference in any order - if the matching calls are not already in the conference, then once the matching calls are added, the coach will be able to hear and speak to the matching calls. Note that this will not add the matching calls to the conference; each call must individually execute a verb to join. - * - * A conference may only have one coach. - */ - public ConferenceBuilder callIdsToCoach(List callIds){ - this.callIdsToCoach = String.join(",", callIds); - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/CustomParam.java b/src/main/java/com/bandwidth/voice/bxml/verbs/CustomParam.java deleted file mode 100644 index 10f35996..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/CustomParam.java +++ /dev/null @@ -1,27 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlAttribute; -import lombok.Builder; - -/** - * You may specify up to 12 elements nested within a tag. These elements define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started. - */ -@Builder -@XmlType(name = CustomParam.TYPE_NAME) -public class CustomParam implements Verb { - public static final String TYPE_NAME = "CustomParam"; - - /** - * (required) The name of this parameter, up to 256 characters. - */ - @XmlAttribute - private String name; - - /** - * (required) The value of this parameter, up to 2048 characters. - */ - @XmlAttribute - private String value; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/FileFormat.java b/src/main/java/com/bandwidth/voice/bxml/verbs/FileFormat.java deleted file mode 100644 index 9d4923f4..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/FileFormat.java +++ /dev/null @@ -1,33 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import com.bandwidth.voice.bxml.verbs.adapter.FileFormatAdapter; -import java.util.Arrays; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -/** - * File format that AudioProducer can handle - */ -@XmlJavaTypeAdapter(FileFormatAdapter.class) -public enum FileFormat { - MP3("mp3"), WAV("wav"); - - private final String name; - - FileFormat(String name) { - this.name = name; - } - - /** - * Converts a string value to an FileFormat Enum - */ - public static FileFormat fromValue(String value) { - return Arrays.asList(FileFormat.values()).stream().filter(e -> e.name().equalsIgnoreCase(value)).findFirst() - .orElseThrow(() -> new IllegalArgumentException(String.format("Unsupported file format '%s'", value))); - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Forward.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Forward.java deleted file mode 100644 index 9cbfd2b8..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Forward.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import java.time.Duration; - -/** - * Forwards an unanswered incoming call to another number. - * - */ -@Builder -@XmlType(name = Forward.TYPE_NAME) -public class Forward implements Verb { - - public static final String TYPE_NAME = "Forward"; - - /** - * Number to forward the call to. Must be in E.164 format (e.g. +15555555555) - */ - @XmlAttribute - private String to; - - /** - * (optional) Number to use for caller ID on the outgoing leg. Must be in E.164 format (e.g. +15555555555). If omitted, assumes the "to" number of the original leg. - */ - @XmlAttribute - private String from; - - /** - * (optional) Number of seconds to wait for an answer before abandoning the call. Default: 30. - */ - @XmlAttribute - private long callTimeout; - - /** - * (optional) Can be any of the following: - *
- * none: No diversion headers are sent on the outbound leg of the transferred call. - *
- * propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. - *
- * stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. - * - */ - @XmlAttribute - private String diversionTreatment; - - - /** - * (optional) This parameter is considered only when diversionTreatment is set to stack. - *
- * Can be any of the following Strings: - *
- * unknown - *
- * user-busy - *
- * no-answer - *
- * unavailable - *
- * unconditional - *
- * time-of-day - *
- * do-not-disturb - *
- * deflection - *
- * follow-me - *
- * out-of-service - *
- * away - * - */ - @XmlAttribute - private String diversionReason; - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Gather.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Gather.java deleted file mode 100644 index 4e8c92b2..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Gather.java +++ /dev/null @@ -1,175 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElements; -import javax.xml.bind.annotation.XmlType; - -/** - * The Gather verb is used to collect digits for some period of time. - */ -@Builder -@XmlType(name = Gather.TYPE_NAME) -public class Gather implements Verb { - public static final String TYPE_NAME = "Gather"; - - /** - * (optional) Using the AudioProducer inside the Gather verb will play the media until a digit is received. - */ - @XmlElements({@XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class), - @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class)}) - private List audioProducer; - - - /** - * (optional) URL to send Gather event to and request new BXML. - */ - @XmlAttribute - private URI gatherUrl; - - /** - * (optional) he HTTP method to use for the request to gatherUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method gatherMethod; - - /** - * (optional) The username to send in the HTTP request to gatherUrl. - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to gatherUrl. - */ - @XmlAttribute - protected String password; - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) When any of these digits are pressed, it will terminate the Gather. Default value is none. - */ - @XmlAttribute - private String terminatingDigits; - - /** - * (optional) Max number of digits to collect. Default value is 50. - */ - @XmlAttribute - private Integer maxDigits; - - /** - * (optional) Time (in seconds) allowed between digit presses before automatically terminating the Gather. Default value is 5. Range: decimal values between 1 - 60. - */ - @XmlAttribute - private Double interDigitTimeout; - - /** - * (optional) Time (in seconds) to pause after any audio from nested or verb is played (in seconds) before terminating the Gather. Can use decimal values. - */ - @XmlAttribute - private Double firstDigitTimeout; - - /** - * (optional) The number of times the audio prompt should be repeated if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. The delay between repetitions will be equal to firstDigitTimeout. Default value is 1. Range: 1-25. - */ - @XmlAttribute - private Integer repeatCount; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI gatherFallbackUrl; - - @XmlAttribute - protected Method gatherFallbackMethod; - - public static class GatherBuilder{ - - /** - * (optional) URL to send Gather event to and request new BXML. Converts string using URI.create(url). - */ - public GatherBuilder gatherUrl(String url){ - return this.gatherUrl(URI.create(url)); - } - - /** - * (optional) URL to send Gather event to and request new BXML. - */ - public GatherBuilder gatherUrl(URI url){ - this.gatherUrl = url; - return this; - } - - public GatherBuilder gatherFallbackUrl(String url){ - return this.gatherFallbackUrl(URI.create(url)); - } - - public GatherBuilder gatherFallbackUrl(URI url){ - this.gatherFallbackUrl = url; - return this; - } - - public GatherBuilder gatherFallbackMethod(String method){ - return this.gatherFallbackMethod(Method.fromValue(method)); - } - - public GatherBuilder gatherFallbackMethod(Method method){ - this.gatherFallbackMethod = method; - return this; - } - - /** - * (optional) Using the AudioProducers inside the Gather verb will play the media(s) until a digit is received. - */ - public GatherBuilder audioProducer(List audioProducers){ - this.audioProducer = audioProducers; - return this; - } - - /** - * (optional) Using the AudioProducer inside the Gather verb will play the media until a digit is received. - */ - public GatherBuilder audioProducer(AudioProducer audioProducer){ - List list = new ArrayList<>(); - list.add(audioProducer); - return this.audioProducer(list); - } - - /** - * (optional) he HTTP method to use for the request to gatherUrl. GET or POST. Default value is POST. Converts String to Method using Method.fromValue(method) - */ - public GatherBuilder gatherMethod(String method){ - return this.gatherMethod(Method.fromValue(method)); - } - - /** - * (optional) he HTTP method to use for the request to gatherUrl. GET or POST. Default value is POST. - */ - public GatherBuilder gatherMethod(Method method){ - this.gatherMethod = method; - return this; - } - } - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Hangup.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Hangup.java deleted file mode 100644 index 29a3bea8..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Hangup.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; - -/** - * The Hangup verb is used to hang up the current call. No further BXML verbs are processed. - *
- * The Hangup verb is also used to reject incoming calls either explicitly or implicitly. - */ -@Builder -@XmlType(name = Hangup.TYPE_NAME) -public class Hangup implements Verb { - public static final String TYPE_NAME = "Hangup"; - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Method.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Method.java deleted file mode 100644 index d9d5e77d..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Method.java +++ /dev/null @@ -1,35 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import com.bandwidth.voice.bxml.verbs.adapter.MethodAdapter; -import java.util.Arrays; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -/** - * HTTP Method to be used in the verb - */ -@XmlJavaTypeAdapter(MethodAdapter.class) -public enum Method { - POST("POST"), GET("GET"); - - private String name; - - Method(String name) { - this.name = name; - } - - /** - * Translates a String value to a Method if applicable - */ - public static Method fromValue(String value) { - return Arrays.stream(Method.values()) - .filter(e -> e.name().equalsIgnoreCase(value)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException(String.format("Unsupported HTTP method '%s'", value))); - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Pause.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Pause.java deleted file mode 100644 index 62c4d8c4..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Pause.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * The Pause verb is used to delay for a set period of time. Silence will be heard. - */ -@Builder -@XmlType(name = Pause.TYPE_NAME) -public class Pause implements Verb { - public static final String TYPE_NAME = "Pause"; - - /** - * (optional) The 'duration' attribute specifies how many seconds Bandwidth will wait silently before continuing on. Default value is 1. Range: decimal values between 0.1 - 86400. - */ - @XmlAttribute - private Double duration; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/PhoneNumber.java b/src/main/java/com/bandwidth/voice/bxml/verbs/PhoneNumber.java deleted file mode 100644 index b3a30158..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/PhoneNumber.java +++ /dev/null @@ -1,164 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - -/** - * Object representation of a Phonenumber - */ -@Builder -@XmlType(name = PhoneNumber.TYPE_NAME) -public class PhoneNumber { - public static final String TYPE_NAME = "PhoneNumber"; - - /** - * The phone number that will be the text content of the tag - */ - @XmlValue - private String phoneNumber; - - /** - * (optional) URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged - */ - @XmlAttribute - private URI transferAnswerUrl; - - /** - * (optional) The HTTP method to use for the request to transferAnswerMethod . GET or POST. Default value is POST. - */ - @XmlAttribute - private Method transferAnswerMethod; - - /** - * (optional) URL, if any, to send the Transfer Disconnect event to and request BXML to be executed for the called party before the call is bridged - */ - @XmlAttribute - private URI transferDisconnectUrl ; - - /** - * (optional) URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged - */ - @XmlAttribute - private Method transferDisconnectMethod ; - - /** - * (optional) The username to send in the HTTP request to transferAnswerUrl. - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to transferAnswerUrl. - */ - @XmlAttribute - protected String password; - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI transferAnswerFallbackUrl; - - @XmlAttribute - protected Method transferAnswerFallbackMethod; - - public static class PhoneNumberBuilder{ - - /** - * (optional) The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferAnswerUrl(String uri){ - return this.transferAnswerUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferAnswerUrl(URI uri){ - this.transferAnswerUrl = uri; - return this; - } - - public PhoneNumberBuilder transferAnswerFallbackUrl(String uri){ - return this.transferAnswerFallbackUrl(URI.create(uri)); - } - - public PhoneNumberBuilder transferAnswerFallbackUrl(URI uri){ - this.transferAnswerFallbackUrl = uri; - return this; - } - - public PhoneNumberBuilder transferAnswerFallbackMethod(String method){ - return this.transferAnswerFallbackMethod(Method.fromValue(method)); - } - - public PhoneNumberBuilder transferAnswerFallbackMethod(Method method){ - this.transferAnswerFallbackMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to transferDisconnectUrl . GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferDisconnectUrl (String uri){ - return this.transferDisconnectUrl (URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to transferDisconnectUrl . GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferDisconnectUrl (URI uri){ - this.transferDisconnectUrl = uri; - return this; - } - - /** - * (optional) The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferAnswerMethod(String method){ - return this.transferAnswerMethod(Method.fromValue(method)); - } - - /** - * (optional) The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferAnswerMethod(Method method){ - this.transferAnswerMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferDisconnectMethod (String method){ - return this.transferDisconnectMethod (Method.fromValue(method)); - } - - /** - * (optional) The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. - */ - public PhoneNumberBuilder transferDisconnectMethod (Method method){ - this.transferDisconnectMethod = method; - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/PlayAudio.java b/src/main/java/com/bandwidth/voice/bxml/verbs/PlayAudio.java deleted file mode 100644 index d42f0ed4..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/PlayAudio.java +++ /dev/null @@ -1,57 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - -/** - * The PlayAudio verb is used to play an audio file in the call. The URL of an audio file should be included in the body of the tag. If a relative URL is given, it is resolved relative to the endpoint that returned the BXML. - *
- * NOTE: .wav files encoded as PCM or G711 are supported. - */ -@Builder -@XmlType(name = PlayAudio.TYPE_NAME) -public class PlayAudio implements Verb, AudioProducer { - - public static final String TYPE_NAME = "PlayAudio"; - - /** - * URL of audio to play - */ - @XmlValue - private URI audioUri; - - /** - * username to authenticate at the audioUri endpoint - */ - @XmlAttribute - protected String username; - - /** - * password to use to authenticate at the audioUri endpoint - */ - @XmlAttribute - protected String password; - - public static class PlayAudioBuilder{ - - /** - * URL of audio to play - */ - public PlayAudioBuilder audioUri(String uri){ - return this.audioUri(URI.create(uri)); - } - - /** - * URL of audio to play - */ - public PlayAudioBuilder audioUri(URI uri){ - this.audioUri = uri; - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Record.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Record.java deleted file mode 100644 index e3acbfe0..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Record.java +++ /dev/null @@ -1,267 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * The Record verb is used to Record the current XML execution to another URL. - */ -@Builder -@XmlType(name = Record.TYPE_NAME) -public class Record implements Verb { - - public static final String TYPE_NAME = "Record"; - - /** - * (optional) A boolean value. If true, the recording will be submitted - * for transcription upon completion. Defaults to false. - */ - @XmlAttribute - private boolean transcribe; - - /** - * (optional) Length of silence after which to end the recording (in seconds). - * Max is equivalent to the maximum maxDuration value. Default value is 0, which - * means no timeout. - */ - @XmlAttribute - private Integer silenceTimeout; - - /** - * (optional) URL to send the transcriptionAvailable event to. - */ - @XmlAttribute - private URI transcriptionAvailableUrl; - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method transcriptionAvailableMethod; - - /** - * (optional) URL to send the Record Complete event to once it has ended. - * Accepts BXML. - */ - @XmlAttribute - private URI recordCompleteUrl; - - /** - * (optional) The HTTP method to use for the request to - * recordCompleteUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method recordCompleteMethod; - - /** - * (optional) URL to send the Record Complete event to once it has ended. - * Accepts BXML. - */ - @XmlAttribute - private URI recordingAvailableUrl; - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method recordingAvailableMethod; - - /** - * (optional) A custom string that will be sent with this and all future - * callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) The username to send in the HTTP request to - * recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be - * TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to - * recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be - * TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String password; - - /** - * (optional) When pressed, this digit will terminate the recording. - * Default value is “#”. - */ - @XmlAttribute - protected String terminatingDigits; - - /** - * (optional) Maximum length of recording (in seconds). Max 10800 (3 - * hours). Default value is 60. - */ - @XmlAttribute - protected Integer maxDuration; - - /** - * (optional) The audio format that the recording will be saved as: mp3 - * or wav. Default value is wav. - */ - @XmlAttribute - protected String fileFormat; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI recordCompleteFallbackUrl; - - @XmlAttribute - protected Method recordCompleteFallbackMethod; - - /** - * (optional) A boolean value to indicate that the recording may not be - * in English, and the transcription service will need to detect the dominant - * language the recording is in and transcribe accordingly. - * Current supported languages are English, French, and Spanish. - */ - @XmlAttribute - protected Boolean detectLanguage; - - public static class RecordBuilder { - - /** - * (required) URL to send the transcriptionAvailable event to. - */ - public RecordBuilder transcriptionAvailableUrl(URI uri) { - this.transcriptionAvailableUrl = uri; - return this; - } - - /** - * (required) URL to send the transcriptionAvailable event to. - */ - public RecordBuilder transcriptionAvailableUrl(String uri) { - return transcriptionAvailableUrl(URI.create(uri)); - } - - public RecordBuilder recordCompleteFallbackUrl(URI uri) { - this.recordCompleteFallbackUrl = uri; - return this; - } - - public RecordBuilder recordCompleteFallbackUrl(String uri) { - return recordCompleteFallbackUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. - */ - public RecordBuilder transcriptionAvailableMethod(Method method) { - this.transcriptionAvailableMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. Converts - * String to Method using Method.fromValue(method) - */ - public RecordBuilder transcriptionAvailableMethod(String method) { - return transcriptionAvailableMethod(Method.fromValue(method)); - } - - public RecordBuilder recordCompleteFallbackMethod(Method method) { - this.recordCompleteFallbackMethod = method; - return this; - } - - public RecordBuilder recordCompleteFallbackMethod(String method) { - return recordCompleteFallbackMethod(Method.fromValue(method)); - } - - /** - * (required) URL to send the Record Complete event to once it has ended. - * Accepts BXML. - */ - public RecordBuilder recordCompleteUrl(URI uri) { - this.recordCompleteUrl = uri; - return this; - } - - /** - * (required) URL to request new BXML from. A Record event will be sent - * to this endpoint. Converts to URI using URI.create(url) - */ - public RecordBuilder recordCompleteUrl(String uri) { - return recordCompleteUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to - * recordCompleteUrl. GET or POST. Default Value is POST. - */ - public RecordBuilder recordCompleteMethod(Method method) { - this.recordCompleteMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to - * recordCompleteUrl. GET or POST. Default Value is POST. Converts String to - * Method using Method.fromValue(method) - */ - public RecordBuilder recordCompleteMethod(String method) { - return recordCompleteMethod(Method.fromValue(method)); - } - - /** - * (required) URL to send the Recording Available event to once it has - * been processed. Does not accept BXML. - */ - public RecordBuilder recordingAvailableUrl(URI uri) { - this.recordingAvailableUrl = uri; - return this; - } - - /** - * (required) URL to send the Recording Available event to once it has - * been processed. Does not accept BXML. - */ - public RecordBuilder recordingAvailableUrl(String uri) { - return recordingAvailableUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. - */ - public RecordBuilder recordingAvailableMethod(Method method) { - this.recordingAvailableMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. Converts String to - * Method using Method.fromValue(method) - */ - public RecordBuilder recordingAvailableMethod(String method) { - return recordingAvailableMethod(Method.fromValue(method)); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Redirect.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Redirect.java deleted file mode 100644 index 21b726e2..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Redirect.java +++ /dev/null @@ -1,116 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * The Redirect verb is used to redirect the current XML execution to another URL. - */ -@Builder -@XmlType(name = Redirect.TYPE_NAME) -public class Redirect implements Verb { - - public static final String TYPE_NAME = "Redirect"; - - - /** - * (required) URL to request new BXML from. A Redirect event will be sent to this endpoint. - */ - @XmlAttribute - private URI redirectUrl; - - /** - * (optional) The HTTP method to use for the request to redirectUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method redirectMethod; - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) The username to send in the HTTP request to redirectUrl. - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to redirectUrl. - */ - @XmlAttribute - protected String password; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI redirectFallbackUrl; - - @XmlAttribute - protected Method redirectFallbackMethod; - - public static class RedirectBuilder { - - /** - * (required) URL to request new BXML from. A Redirect event will be sent to this endpoint. - */ - public RedirectBuilder redirectUrl(URI uri ){ - this.redirectUrl = uri; - return this; - } - - /** - * (required) URL to request new BXML from. A Redirect event will be sent to this endpoint. Converts to URI using URI.create(url) - */ - public RedirectBuilder redirectUrl(String uri){ - return redirectUrl(URI.create(uri)); - } - - public RedirectBuilder redirectFallbackUrl(URI uri ){ - this.redirectUrl = uri; - return this; - } - - public RedirectBuilder redirectFallbackUrl(String uri){ - return redirectUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to redirectUrl. GET or POST. Default Value is POST. - */ - public RedirectBuilder redirectMethod(Method method){ - this.redirectMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to redirectUrl. GET or POST. Default Value is POST. Converts String to Method using Method.fromValue(method) - */ - public RedirectBuilder redirectMethod(String method){ - return redirectMethod(Method.fromValue(method)); - } - - public RedirectBuilder redirectFallbackMethod(Method method){ - this.redirectFallbackMethod = method; - return this; - } - - public RedirectBuilder redirectFallbackMethod(String method){ - return redirectFallbackMethod(Method.fromValue(method)); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Response.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Response.java deleted file mode 100644 index ebbd31a1..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Response.java +++ /dev/null @@ -1,138 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.io.ByteArrayOutputStream; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElements; -import javax.xml.bind.annotation.XmlRootElement; - -@Builder -@XmlRootElement(name = Response.TYPE_NAME) -public class Response { - public static final String TYPE_NAME = "Response"; - - private static JAXBContext jaxbContext; - - @XmlElements({ - @XmlElement(name = Gather.TYPE_NAME, type = Gather.class), - @XmlElement(name = Hangup.TYPE_NAME, type = Hangup.class), - @XmlElement(name = Redirect.TYPE_NAME, type = Redirect.class), - @XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class), - @XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class), - @XmlElement(name = Transfer.TYPE_NAME, type = Transfer.class), - @XmlElement(name = Pause.TYPE_NAME, type = Pause.class), - @XmlElement(name = Forward.TYPE_NAME, type = Forward.class), - @XmlElement(name = SendDtmf.TYPE_NAME, type = SendDtmf.class), - @XmlElement(name = Record.TYPE_NAME, type = Record.class), - @XmlElement(name = StartRecording.TYPE_NAME, type = StartRecording.class), - @XmlElement(name = StopRecording.TYPE_NAME, type = StopRecording.class), - @XmlElement(name = PauseRecording.TYPE_NAME, type = PauseRecording.class), - @XmlElement(name = ResumeRecording.TYPE_NAME, type = ResumeRecording.class), - @XmlElement(name = Conference.TYPE_NAME, type = Conference.class), - @XmlElement(name = Bridge.TYPE_NAME, type = Bridge.class), - @XmlElement(name = Ring.TYPE_NAME, type = Ring.class), - @XmlElement(name = StartGather.TYPE_NAME, type = StartGather.class), - @XmlElement(name = StopGather.TYPE_NAME, type = StopGather.class), - @XmlElement(name = Tag.TYPE_NAME, type = Tag.class), - @XmlElement(name = SipUri.TYPE_NAME, type = SipUri.class), - @XmlElement(name = StartStream.TYPE_NAME, type = StartStream.class), - @XmlElement(name = StopStream.TYPE_NAME, type = StopStream.class), - @XmlElement(name = StartTranscription.TYPE_NAME, type = StartTranscription.class), - @XmlElement(name = StopTranscription.TYPE_NAME, type = StopTranscription.class), - @XmlElement(name = CustomParam.TYPE_NAME, type = CustomParam.class), - - - }) - private final List verbs = new ArrayList<>(); - - private static final Pattern XML_PATTERN = Pattern.compile("<([a-zA-Z//].*?)>"); - - private static final Pattern SPEAK_SENTENCE_PATTERN = Pattern.compile("(.*?)<\\/SpeakSentence>"); - - - - public Response(){ - } - - - - - /** - * Returns list of verbs in this Response - */ - public List getVerbs() { - return verbs; - } - - /** - * Adds a Verb to the list of Verbs in this Response - */ - public Response add(Verb verb) { - this.verbs.add(verb); - return this; - } - - /** - * Adds Verbs to the list of Verbs in this Response - */ - public Response addAll(Verb... verbs) { - this.verbs.addAll(Arrays.asList(verbs)); - return this; - } - - /** - * Convert this Response and its verbs into their corresponding XML and get the result as a String - * - */ - public String toBXML() { - OutputStream outputStream = new ByteArrayOutputStream(); - try { - getMarshaller().marshal(this, outputStream); - } catch (JAXBException e) { - throw new RuntimeException("Error creating BXML marshaller", e); - } - - Matcher matcherSpeakSentence = SPEAK_SENTENCE_PATTERN.matcher(outputStream.toString()); - - StringBuffer sb = new StringBuffer(); - - while(matcherSpeakSentence.find()){ - Matcher matcher = XML_PATTERN.matcher(matcherSpeakSentence.group()); - String replaced = matcher.replaceAll("<$1>").replaceAll("\\?", "\\?"); - matcherSpeakSentence.appendReplacement(sb, replaced); - } - - matcherSpeakSentence.appendTail(sb); - - return sb.toString(); - - - } - - private Marshaller getMarshaller() { - try { - // This isn't thread-unsafe, it's just expensive to create. So no locking necessary. - if (jaxbContext == null) { - jaxbContext = JAXBContext.newInstance(Response.class); - } - Marshaller marshaller = jaxbContext.createMarshaller(); - marshaller.setProperty("com.sun.xml.bind.xmlHeaders", ""); - marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); - - return marshaller; - } catch (JAXBException e) { - throw new RuntimeException("Error creating JAXB context for BXML serialization", e); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/ResumeRecording.java b/src/main/java/com/bandwidth/voice/bxml/verbs/ResumeRecording.java deleted file mode 100644 index 27b5a1e7..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/ResumeRecording.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; - -/** - * The ResumeRecording verb is used to resume a recording that was previously paused by a verb. - *
- * Audio that occurs between a verb and a verb will not be present in the recording. - *
- * The paused period will not be included in the duration of the recording and therefore will not contribute to the recording portion of the bill. - *
- * If there is not an ongoing recording at the time of this verb's execution, it has no effect. - */ -@Builder -@XmlType(name = ResumeRecording.TYPE_NAME) -public class ResumeRecording implements Verb { - public static final String TYPE_NAME = "ResumeRecording"; - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Ring.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Ring.java deleted file mode 100644 index e94003bd..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Ring.java +++ /dev/null @@ -1,29 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * The Ring verb is used to play ringing audio on a call. - */ -@Builder -@XmlType(name = Ring.TYPE_NAME) -public class Ring implements Verb { - public static final String TYPE_NAME = "Ring"; - - /** - * (optional) How many seconds to play ringing on the call. Default value is 5. Range: decimal values between 0.1 - 86400. - */ - @XmlAttribute - private Double duration; - - /** - * (optional) A boolean indicating whether or not to answer the call when Ring is executed on an unanswered - * incoming call. Default value is 'true'. - */ - @XmlAttribute - private Boolean answerCall; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/SendDtmf.java b/src/main/java/com/bandwidth/voice/bxml/verbs/SendDtmf.java deleted file mode 100644 index 0bff74e3..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/SendDtmf.java +++ /dev/null @@ -1,44 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.XmlAttribute; - -/** - * The SendDtmf verb is used to play DTMF digits in the call. - * - *

    - *
  • The , and lowercase w characters introduce a half-second pause into the - * DTMF sequence.
  • - *
  • An uppercase W character introduces a one-second pause into the DTMF - * sequence.
  • - *
  • *, #, a-d, and A-D are also supported in addition to the numeric - * characters 0-9.
  • - *
- */ -@Builder -@XmlType(name = SendDtmf.TYPE_NAME) -public class SendDtmf implements Verb { - - public static final String TYPE_NAME = "SendDtmf"; - - @XmlValue - private String digits; - - /** - * (optional) The length (in milliseconds) of each DTMF tone. Default value is - * 200. Range: decimal values between 50 - 5000. - */ - @XmlAttribute - private Double toneDuration; - - /** - * (optional) The duration of silence (in milliseconds) following each DTMF - * tone. Default value is 400. Range: decimal values between 50 - 5000. - */ - @XmlAttribute - private Double toneInterval; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/SipUri.java b/src/main/java/com/bandwidth/voice/bxml/verbs/SipUri.java deleted file mode 100644 index be86a526..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/SipUri.java +++ /dev/null @@ -1,156 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import lombok.Builder; - -/** - */ -@Builder -@XmlType(name = SipUri.TYPE_NAME) -public class SipUri implements Verb { - public static final String TYPE_NAME = "SipUri"; - - /** - * SipUri to transfer to - */ - @XmlValue - private String sipUri; - - /** - * (optional) The value of the User-To-User header to send within the initial INVITE. Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. This value, including the encoding specifier, may not exceed 256 characters. - */ - @XmlAttribute - private String uui; - - /** - * (optional) URL, if any, to send the Transfer Answer event to and request BXML to be executed for the called party before the call is bridged. May be a relative URL. - */ - @XmlAttribute - private URI transferAnswerUrl; - - /** - * (optional) The HTTP method to use for the request to transferAnswerUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method transferAnswerMethod; - - /** - * (optional) A fallback url which, if provided, will be used to retry the Transfer Answer callback delivery in case transferAnswerUrl fails to respond. - */ - @XmlAttribute - private URI transferAnswerFallbackUrl; - - /** - * (optional) The HTTP method to use to deliver the Transfer Answer callback to transferAnswerFallbackUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method transferAnswerFallbackMethod; - - /** - * (optional) URL, if any, to send the Transfer Disconnect event to. This event will be sent regardless of how the transfer ends and may not be responded to with BXML. May be a relative URL. - */ - @XmlAttribute - private URI transferDisconnectUrl; - - /** - * (optional) The HTTP method to use for the request to transferDisconnectUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method transferDisconnectMethod; - - /** - * (optional) The username to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. - */ - @XmlAttribute - private String username; - - /** - * (optional) The password to send in the HTTP request to transferAnswerUrl and transferDisconnectUrl. - */ - @XmlAttribute - private String password; - - /** - * (optional) The username to send in the HTTP request to transferAnswerFallbackUrl. - */ - @XmlAttribute - private String fallbackUsername; - - /** - * (optional) The password to send in the HTTP request to transferAnswerFallbackUrl. - */ - @XmlAttribute - private String fallbackPassword; - - /** - * (optional) A custom string that will be sent with these and all future callbacks unless overwritten by a future tag attribute or cleared. - * - * May be cleared by setting tag="" - * - * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - public static class SipUriBuilder { - - - public SipUri.SipUriBuilder transferAnswerUrl(URI uri){ - this.transferAnswerUrl = uri; - return this; - } - - public SipUri.SipUriBuilder transferAnswerUrl(String uri){ - return transferAnswerUrl(URI.create(uri)); - } - - public SipUri.SipUriBuilder transferAnswerMethod(Method method){ - this.transferAnswerMethod = method; - return this; - } - - public SipUri.SipUriBuilder transferAnswerMethod(String method){ - return transferAnswerMethod(Method.fromValue(method)); - } - - public SipUri.SipUriBuilder transferAnswerFallbackUrl(URI uri){ - this.transferAnswerFallbackUrl = uri; - return this; - } - - public SipUri.SipUriBuilder transferAnswerFallbackUrl(String uri){ - return transferAnswerFallbackUrl(URI.create(uri)); - } - - public SipUri.SipUriBuilder transferAnswerFallbackMethod(Method method){ - this.transferAnswerFallbackMethod = method; - return this; - } - - public SipUri.SipUriBuilder transferAnswerFallbackMethod(String method){ - return transferAnswerFallbackMethod(Method.fromValue(method)); - } - - public SipUri.SipUriBuilder transferDisconnectUrl(URI uri){ - this.transferDisconnectUrl = uri; - return this; - } - - public SipUri.SipUriBuilder transferDisconnectUrl(String uri){ - return transferDisconnectUrl(URI.create(uri)); - } - - public SipUri.SipUriBuilder transferDisconnectMethod(Method method){ - this.transferDisconnectMethod = method; - return this; - } - - public SipUri.SipUriBuilder transferDisconnectMethod(String method){ - return transferDisconnectMethod(Method.fromValue(method)); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/SpeakSentence.java b/src/main/java/com/bandwidth/voice/bxml/verbs/SpeakSentence.java deleted file mode 100644 index f56e4200..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/SpeakSentence.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; - -import lombok.Builder; - -/** - * The SpeakSentence verb translates text to speech and plays the resulting audio on the call - *
- * Attributes of the speaker may be changed using these values. The default speaker is a female speaker with locale en_US. - *
- * If a voice is chosen then gender and locale are over-written - * - *@author bandwidth - */ -@Builder -@XmlType(name = SpeakSentence.TYPE_NAME) -public class SpeakSentence implements Verb, AudioProducer { - - public static final String TYPE_NAME = "SpeakSentence"; - - /** - * String representation of audio to speak - */ - @XmlValue - private String text; - - /** - * Selects the voice of the speaker. - */ - @XmlAttribute - private String voice; - - /** - * Selects the gender of the speaker. Valid values are "male" or "female". - *
- * Default "female" - */ - @XmlAttribute - private String gender; - - /** - *Selects the locale of the speaker. - *
- * Default "en_US" - */ - @XmlAttribute - private String locale; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StartGather.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StartGather.java deleted file mode 100644 index 1c75e943..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StartGather.java +++ /dev/null @@ -1,79 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import java.net.URI; - -/** - * Start Gather Verb - */ -@Builder -@XmlType(name = StartGather.TYPE_NAME) -public class StartGather implements Verb { - public static final String TYPE_NAME = "StartGather"; - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) The username to send in the HTTP request to recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String password; - - @XmlAttribute - protected URI dtmfUrl; - - @XmlAttribute - protected Method dtmfMethod; - - public static class StartGatherBuilder { - - /** - * URL to send the DTMF event to. May be a relative URL. - */ - public StartGatherBuilder dtmfUrl(URI uri ){ - this.dtmfUrl = uri; - return this; - } - - /** - * URL to send the DTMF event to. May be a relative URL. - */ - public StartGatherBuilder dtmfUrl(String uri){ - return dtmfUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to dtmfUrl. GET or POST. Default value is POST. - */ - public StartGatherBuilder dtmfMethod(Method method){ - this.dtmfMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to dtmfUrl. GET or POST. Default value is POST. Converts String to Method using Method.fromValue(method) - */ - public StartGatherBuilder dtmfMethod(String method){ - return dtmfMethod(Method.fromValue(method)); - } - } - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StartRecording.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StartRecording.java deleted file mode 100644 index 2db8447a..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StartRecording.java +++ /dev/null @@ -1,178 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * The StartRecording verb allows a segment of a call to be recorded while other - * verbs are executing. - *
- * All audio on both sides of the call will be recorded until the call ends or - * the verb is used or the verb is used. - */ -@Builder -@XmlType(name = StartRecording.TYPE_NAME) -public class StartRecording implements Verb { - public static final String TYPE_NAME = "StartRecording"; - - /** - * (optional) A boolean value. If true, the recording will be submitted - * for transcription upon completion. Defaults to false. - */ - @XmlAttribute - private boolean transcribe; - - /** - * (optional) URL to send the transcriptionAvailable event to. - */ - @XmlAttribute - private URI transcriptionAvailableUrl; - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method transcriptionAvailableMethod; - - /** - * (optional) URL to send the Record Complete event to once it has ended. - * Accepts BXML. - */ - @XmlAttribute - private URI recordingAvailableUrl; - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. - */ - @XmlAttribute - private Method recordingAvailableMethod; - - /** - * (optional) A custom string that will be sent with this and all future - * callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) The username to send in the HTTP request to - * recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be - * TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to - * recordCompleteUrl or recordingAvailableUrl. If specified, the URLs must be - * TLS-encrypted (i.e., https). - */ - @XmlAttribute - protected String password; - - /** - * (optional) A boolean value indicating whether or not the recording - * file should separate each side of the call into its own audio channel. - * Default value is false. true results in two channels. - */ - @XmlAttribute - protected boolean multiChannel; - - /** - * (optional) The audio format that the recording will be saved as: mp3 - * or wav. Default value is wav. - */ - @XmlAttribute - protected String fileFormat; - - /** - * (optional) A boolean value to indicate that the recording may not be - * in English, and the transcription service will need to detect the dominant - * language the recording is in and transcribe accordingly. - * Current supported languages are English, French, and Spanish. - */ - @XmlAttribute - protected Boolean detectLanguage; - - public static class StartRecordingBuilder { - - /** - * (required) URL to send the transcriptionAvailable event to. - */ - public StartRecordingBuilder transcriptionAvailableUrl(URI uri) { - this.transcriptionAvailableUrl = uri; - return this; - } - - /** - * (required) URL to send the transcriptionAvailable event to. - */ - public StartRecordingBuilder transcriptionAvailableUrl(String uri) { - return transcriptionAvailableUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. - */ - public StartRecordingBuilder transcriptionAvailableMethod(Method method) { - this.transcriptionAvailableMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to - * transcriptionAvailableUrl. GET or POST. Default Value is POST. Converts - * String to Method using Method.fromValue(method) - */ - public StartRecordingBuilder transcriptionAvailableMethod(String method) { - return transcriptionAvailableMethod(Method.fromValue(method)); - } - - /** - * (required) URL to send the Recording Available event to once it has - * been processed. Does not accept BXML. - */ - public StartRecordingBuilder recordingAvailableUrl(URI uri) { - this.recordingAvailableUrl = uri; - return this; - } - - /** - * (required) URL to send the Recording Available event to once it has - * been processed. Does not accept BXML. - */ - public StartRecordingBuilder recordingAvailableUrl(String uri) { - return recordingAvailableUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. - */ - public StartRecordingBuilder recordingAvailableMethod(Method method) { - this.recordingAvailableMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to - * recordingAvailableUrl. GET or POST. Default Value is POST. Converts String to - * Method using Method.fromValue(method) - */ - public StartRecordingBuilder recordingAvailableMethod(String method) { - return recordingAvailableMethod(Method.fromValue(method)); - } - } - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StartStream.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StartStream.java deleted file mode 100644 index e0422697..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StartStream.java +++ /dev/null @@ -1,137 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlElement; - - -/** - * The StartStream verb allows a segment of a call to be streamed to an external destination. - */ -@Builder -@XmlType(name = StartStream.TYPE_NAME) -public class StartStream implements Verb { - public static final String TYPE_NAME = "StartStream"; - - /** - * You may specify up to 12 elements nested within a tag. These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started. - */ - @XmlElement(name = StreamParam.TYPE_NAME) - private final List streamParams; - - /** - * (optional) A name to refer to this stream by. Used when sending [``][1]. If not provided, a random name will be generated and sent in the [`Media Stream Started`][2] webook. - */ - @XmlAttribute - private String name; - - /** - * (optional) The part of the call to send a stream from. `inbound`, `outbound` or `both`. Default is `inbound`. - */ - @XmlAttribute - private String tracks; - - /** - * (required) A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL encoded as base64 encoded PCMU/G711 audio. See below for more details on the websocket packet format. - */ - @XmlAttribute - private URI destination; - - /** - * (optional) URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. - */ - @XmlAttribute - private URI streamEventUrl; - - /** - * (optional) The HTTP method to use for the request to `streamEventUrl`. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method streamEventMethod; - - /** - * (optional) The username to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to `streamEventUrl`. If specified, the URLs must be TLS-encrypted (i.e., `https`). - */ - @XmlAttribute - protected String password; - - - public static class StartStreamBuilder { - - /** - * (optional) URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. - */ - public StartStreamBuilder streamEventUrl(URI uri ){ - this.streamEventUrl = uri; - return this; - } - - /** - * (optional) URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL. - */ - public StartStreamBuilder streamEventUrl(String uri ){ - return streamEventUrl(URI.create(uri)); - } - - /** - * (required) A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL encoded as base64 encoded PCMU/G711 audio. See below for more details on the websocket packet format. - */ - public StartStreamBuilder destination(URI uri ){ - this.destination = uri; - return this; - } - - /** - * (optional) A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL encoded as base64 encoded PCMU/G711 audio. See below for more details on the websocket packet format. - */ - public StartStreamBuilder destination(String uri ){ - return destination(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to `streamEventUrl`. GET or POST. Default value is POST. - */ - public StartStreamBuilder streamEventMethod(Method method){ - this.streamEventMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to `streamEventUrl`. GET or POST. Default value is POST. - */ - public StartStreamBuilder streamEventMethod(String method){ - return streamEventMethod(Method.fromValue(method)); - } - - /** - * (optional) You may specify up to 12 elements nested within a tag. These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started. - */ - public StartStreamBuilder streamParams(StreamParam ... streamParams){ - this.streamParams = Arrays.asList(streamParams); - return this; - } - - /** - * (optional) You may specify up to 12 elements nested within a tag. These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started. - */ - public StartStreamBuilder streamParams(List streamParams){ - this.streamParams = streamParams; - return this; - } - } - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StartTranscription.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StartTranscription.java deleted file mode 100644 index d384ba45..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StartTranscription.java +++ /dev/null @@ -1,139 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlElement; - - -/** - * The StartTranscription verb allows a segment of a call to be transcribed and optionally for the live transcription to be sent off to another destination for additional processing. - */ -@Builder -@XmlType(name = StartTranscription.TYPE_NAME) -public class StartTranscription implements Verb { - public static final String TYPE_NAME = "StartTranscription"; - - @XmlElement(name = CustomParam.TYPE_NAME) - private final List customParams; - - /** - * (optional) A name to refer to this transcription by. Used when sending . If not provided, it will default to the generated transcription id as sent in the Real-Time Transcription Started webhook. - */ - @XmlAttribute - private String name; - - /** - * (optional) the part of the call to send a transcription from. `inbound`, `outbound` or `both`. default is `inbound`. - */ - @XmlAttribute - private String tracks; - - /** - * (optional) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format. - */ - @XmlAttribute - private URI destination; - - /** - * (optional) Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. - */ - @XmlAttribute - private Boolean stabilized; - - /** - * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. Does not accept bxml. May be a relative URL. - */ - @XmlAttribute - private URI transcriptionEventUrl; - - /** - * (optional) the http method to use for the request to `transcriptioneventurl`. get or post. default value is post. - */ - @XmlAttribute - private Method transcriptionEventMethod; - - /** - * (optional) the username to send in the http request to `transcriptioneventurl`. if specified, the urls must be tls-encrypted (i.e., `https`). - */ - @XmlAttribute - protected String username; - - /** - * (optional) the password to send in the http request to `transcriptioneventurl`. if specified, the urls must be tls-encrypted (i.e., `https`). - */ - @XmlAttribute - protected String password; - - - public static class StartTranscriptionBuilder { - - /** - * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. does not accept bxml. may be a relative url. - */ - public StartTranscriptionBuilder transcriptionEventUrl(URI uri ){ - this.transcriptionEventUrl = uri; - return this; - } - - /** - * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. does not accept bxml. may be a relative url. - */ - public StartTranscriptionBuilder transcriptionEventUrl(String uri ){ - return transcriptionEventUrl(URI.create(uri)); - } - - /** - * (required) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format. - */ - public StartTranscriptionBuilder destination(URI uri ){ - this.destination = uri; - return this; - } - - /** - * (optional) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format. - */ - public StartTranscriptionBuilder destination(String uri ){ - return destination(URI.create(uri)); - } - - /** - * (optional) the http method to use for the request to `transcriptioneventurl`. get or post. default value is post. - */ - public StartTranscriptionBuilder transcriptionEventMethod(Method method){ - this.transcriptionEventMethod = method; - return this; - } - - /** - * (optional) the http method to use for the request to `transcriptionEventUrl`. GET or POST. Default value is POST. - */ - public StartTranscriptionBuilder transcriptionEventMethod(String method){ - return transcriptionEventMethod(Method.fromValue(method)); - } - - /** - * (optional) you may specify up to 12 elements nested within a tag. these elements define optional user specified parameters that will be sent to the destination url when the real-time transcription is first started. - */ - public StartTranscriptionBuilder customParams(CustomParam ... customParams){ - this.customParams = Arrays.asList(customParams); - return this; - } - - /** - * (optional) you may specify up to 12 elements nested within a tag. these elements define optional user specified parameters that will be sent to the destination url when the real-time transcription is first started. - */ - public StartTranscriptionBuilder customParams(List customParams){ - this.customParams = customParams; - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StopGather.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StopGather.java deleted file mode 100644 index cd395868..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StopGather.java +++ /dev/null @@ -1,16 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; - -/** - * Stop Gather Verb - */ -@Builder -@XmlType(name = StopGather.TYPE_NAME) -public class StopGather implements Verb { - public static final String TYPE_NAME = "StopGather"; - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StopRecording.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StopRecording.java deleted file mode 100644 index 5619ca20..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StopRecording.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import javax.xml.bind.annotation.XmlType; - -/** - * The StopRecording verb is used to stop a recording that was previously started by a verb. - *
- * If there is not an ongoing recording at the time of this verb's execution, it has no effect. If a previous recording was paused, will end it. - */ -@Builder -@XmlType(name = StopRecording.TYPE_NAME) -public class StopRecording implements Verb { - public static final String TYPE_NAME = "StopRecording"; - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StopStream.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StopStream.java deleted file mode 100644 index 542ebf88..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StopStream.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - * The StopStream verb is used to stop a stream previously started by a `` verb. - */ -@Builder -@XmlType(name = StopStream.TYPE_NAME) -public class StopStream implements Verb { - public static final String TYPE_NAME = "StopStream"; - - /** - * (required) A name to refer to this stream by. Used when sending [``][1]. If not provided, a random name will be generated and sent in the [`Media Stream Started`][2] webook. - */ - @XmlAttribute - private String name; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StopTranscription.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StopTranscription.java deleted file mode 100644 index 55e0058f..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StopTranscription.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - - -/** - * The Stoptranscription verb is used to stop the real-time transcription previously started by a `` verb. - */ -@Builder -@XmlType(name = StopTranscription.TYPE_NAME) -public class StopTranscription implements Verb { - public static final String TYPE_NAME = "StopTranscription"; - - /** - * (required) The name of the real-time transcription to stop. This is either the user selected name when sending the verb, or the system generated name returned in the Real-Time Transcription Started webhook if was sent with no name attribute. If no name is specified, then all active call transcriptions will be stopped. - */ - @XmlAttribute - private String name; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/StreamParam.java b/src/main/java/com/bandwidth/voice/bxml/verbs/StreamParam.java deleted file mode 100644 index 9f006a39..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/StreamParam.java +++ /dev/null @@ -1,29 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; - -/** - * Object representation of a StreamParam - */ -@Builder -@XmlType(name = StreamParam.TYPE_NAME) -public class StreamParam { - public static final String TYPE_NAME = "StreamParam"; - - /** - * (required) The name of this parameter, up to 256 characters. - */ - @XmlAttribute - private String name; - - /** - * (required) The value of this parameter, up to 2048 characters. - */ - @XmlAttribute - private String value; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Tag.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Tag.java deleted file mode 100644 index 6e75e356..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Tag.java +++ /dev/null @@ -1,21 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import lombok.Builder; - -/** - * The Tag verb is used to set a new tag value without executing a callback. This new tag will be sent with all future callbacks unless overwritten by a future tag attribute or verb, or cleared. - */ -@Builder -@XmlType(name = Tag.TYPE_NAME) -public class Tag implements Verb { - public static final String TYPE_NAME = "Tag"; - - /** - * The new tag value. Leading and trailing whitespace is trimmed. Leave blank to clear the tag. - */ - @XmlValue - private String value; -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Transfer.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Transfer.java deleted file mode 100644 index c0560e48..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Transfer.java +++ /dev/null @@ -1,207 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import lombok.Builder; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -/** - * The Transfer verb is used to bridge another party onto the current call. - */ -@Builder -@XmlType(name = Transfer.TYPE_NAME) -public class Transfer implements Verb { - - public static final String TYPE_NAME = "Transfer"; - - /** - * A collection of phone numbers to transfer the call to. The first to answer will be transferred. - */ - @XmlElement(name = PhoneNumber.TYPE_NAME) - private final List phoneNumbers; - - /** - * A collection of SipUris to transfer the call to. The first to answer will be transferred. - */ - @XmlElement(name = SipUri.TYPE_NAME) - private final List sipUris; - - /** - * (optional) The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555). - *
- * Note: Leave blank to pass along the number of the remote party - */ - @XmlAttribute - private String transferCallerId; - - /** - * (optional) This is the timeout (in seconds) for the callee to answer the call. Range: decimal values between 1 - 300 - */ - @XmlAttribute - private Double callTimeout; - - /** - * (optional) URL to send the Transfer Complete event to and request new BXML. - */ - @XmlAttribute - private URI transferCompleteUrl; - - /** - * (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. - */ - @XmlAttribute - private Method transferCompleteMethod; - - /** - * (optional) The username to send in the HTTP request to transferCompleteUrl. - */ - @XmlAttribute - protected String username; - - /** - * (optional) The password to send in the HTTP request to transferCompleteUrl. - */ - @XmlAttribute - protected String password; - - - /** - * (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. - *
- * May be cleared by setting tag="" - *
- * Max length 256 characters. - */ - @XmlAttribute - private String tag; - - /** - * (optional) Can be any of the following: - *
- * none: No diversion headers are sent on the outbound leg of the transferred call. - *
- * propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg. - *
- * stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call. - * - */ - @XmlAttribute - private String diversionTreatment; - - /** - * (optional) This parameter is considered only when diversionTreatment is set to stack. - *
- * Can be any of the following Strings: - *
- * unknown - *
- * user-busy - *
- * no-answer - *
- * unavailable - *
- * unconditional - *
- * time-of-day - *
- * do-not-disturb - *
- * deflection - *
- * follow-me - *
- * out-of-service - *
- * away - * - */ - @XmlAttribute - private String diversionReason; - - @XmlAttribute - protected String fallbackUsername; - - @XmlAttribute - protected String fallbackPassword; - - @XmlAttribute - protected URI transferCompleteFallbackUrl; - - @XmlAttribute - protected Method transferCompleteFallbackMethod; - - public static class TransferBuilder { - - /** - * (optional) URL to send the Transfer Complete event to and request new BXML. - */ - public TransferBuilder transferCompleteUrl(URI uri){ - this.transferCompleteUrl = uri; - return this; - } - - /** - * (optional) URL to send the Transfer Complete event to and request new BXML. Converts String using URI.create(uri) - */ - public TransferBuilder transferCompleteUrl(String uri){ - return transferCompleteUrl(URI.create(uri)); - } - - public TransferBuilder transferCompleteFallbackUrl(URI uri){ - this.transferCompleteFallbackUrl = uri; - return this; - } - - public TransferBuilder transferCompleteFallbackUrl(String uri){ - return transferCompleteFallbackUrl(URI.create(uri)); - } - - /** - * (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. - */ - public TransferBuilder transferCompleteMethod(Method method){ - this.transferCompleteMethod = method; - return this; - } - - /** - * (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Converts from String using Method.fromValue(method) - */ - public TransferBuilder transferCompleteMethod(String method){ - return transferCompleteMethod(Method.fromValue(method)); - } - - public TransferBuilder transferCompleteFallbackMethod(Method method){ - this.transferCompleteFallbackMethod = method; - return this; - } - - public TransferBuilder transferCompleteFallbackMethod(String method){ - return transferCompleteFallbackMethod(Method.fromValue(method)); - } - - /** - * A collection of phone numbers to transfer the call to. The first to answer will be transferred. - */ - public TransferBuilder phoneNumbers(PhoneNumber ... phoneNumbers){ - this.phoneNumbers = Arrays.asList(phoneNumbers); - return this; - } - - /** - * A collection of phone numbers to transfer the call to. The first to answer will be transferred. - */ - public TransferBuilder phoneNumbers(List phoneNumbers){ - this.phoneNumbers = phoneNumbers; - return this; - } - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Verb.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Verb.java deleted file mode 100644 index 2c137527..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Verb.java +++ /dev/null @@ -1,9 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -/** - * BXML verb - */ -public interface Verb { - -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/Voice.java b/src/main/java/com/bandwidth/voice/bxml/verbs/Voice.java deleted file mode 100644 index dd43aa2c..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/Voice.java +++ /dev/null @@ -1,38 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs; - -import com.bandwidth.voice.bxml.verbs.adapter.VoiceAdapter; - -import java.util.Arrays; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -/** - * The list of names that can be used in the SpeakSentence Verb - */ -@XmlJavaTypeAdapter(VoiceAdapter.class) -public enum Voice { - EMILY("Emily"), ETHAN("Ethan"), MARIANA("Mariana"), MATEO("Mateo"), JANE("Jane"), JAMES("James"), MILA("Mila"), - MAX("Max"), ELLA("Ella"), CHLOE("Chloe"), CHRISTOPHE("Christophe"), SOPHIA("Sophia"), STEFANO("Stefano"), - ELAINE("Elaine"); - - private final String name; - - Voice(String name) { - this.name = name; - } - - /** - * Translates a string into a Voice Enum - */ - public static Voice fromValue(String value) { - return Arrays.stream(Voice.values()) - .filter(e -> e.name().equalsIgnoreCase(value)) - .findFirst() - .orElseThrow(() -> new IllegalArgumentException(String.format("Unsupported voice '%s'", value))); - } - - @Override - public String toString() { - return name; - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/FileFormatAdapter.java b/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/FileFormatAdapter.java deleted file mode 100644 index 47c5c582..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/FileFormatAdapter.java +++ /dev/null @@ -1,19 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs.adapter; - -import com.bandwidth.voice.bxml.verbs.FileFormat; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class FileFormatAdapter extends XmlAdapter { - - @Override - public FileFormat unmarshal(String v) throws Exception { - return FileFormat.fromValue(v); - } - - @Override - public String marshal(FileFormat v) throws Exception { - return v == null ? null : v.toString(); - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/MethodAdapter.java b/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/MethodAdapter.java deleted file mode 100644 index e2a77a73..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/MethodAdapter.java +++ /dev/null @@ -1,19 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs.adapter; - -import com.bandwidth.voice.bxml.verbs.Method; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class MethodAdapter extends XmlAdapter { - - @Override - public Method unmarshal(String v) throws Exception { - return Method.fromValue(v); - } - - @Override - public String marshal(Method v) throws Exception { - return v == null ? null : v.toString(); - } -} diff --git a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/VoiceAdapter.java b/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/VoiceAdapter.java deleted file mode 100644 index 5d15836b..00000000 --- a/src/main/java/com/bandwidth/voice/bxml/verbs/adapter/VoiceAdapter.java +++ /dev/null @@ -1,18 +0,0 @@ - -package com.bandwidth.voice.bxml.verbs.adapter; - -import com.bandwidth.voice.bxml.verbs.Voice; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class VoiceAdapter extends XmlAdapter { - - @Override - public Voice unmarshal(String v) throws Exception { - return Voice.fromValue(v); - } - - @Override - public String marshal(Voice v) throws Exception { - return v == null ? null : v.toString(); - } -} diff --git a/src/main/java/com/bandwidth/voice/controllers/APIController.java b/src/main/java/com/bandwidth/voice/controllers/APIController.java deleted file mode 100644 index aa22d760..00000000 --- a/src/main/java/com/bandwidth/voice/controllers/APIController.java +++ /dev/null @@ -1,3083 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.controllers; - -import com.bandwidth.ApiHelper; -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.Server; -import com.bandwidth.controllers.BaseController; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.Headers; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.voice.exceptions.ApiErrorException; -import com.bandwidth.voice.models.CallRecordingMetadata; -import com.bandwidth.voice.models.CallState; -import com.bandwidth.voice.models.ConferenceMemberState; -import com.bandwidth.voice.models.ConferenceRecordingMetadata; -import com.bandwidth.voice.models.ConferenceState; -import com.bandwidth.voice.models.CreateCallRequest; -import com.bandwidth.voice.models.CreateCallResponse; -import com.bandwidth.voice.models.DynamicResponse; -import com.bandwidth.voice.models.ModifyCallRecordingRequest; -import com.bandwidth.voice.models.ModifyCallRequest; -import com.bandwidth.voice.models.ModifyConferenceRequest; -import com.bandwidth.voice.models.TranscribeRecordingRequest; -import com.bandwidth.voice.models.TranscriptionResponse; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * This class lists all the endpoints of the groups. - */ -public final class APIController extends BaseController { - - /** - * Initializes the controller. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers) { - super(config, httpClient, authManagers); - } - - /** - * Initializes the controller with HTTPCallback. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - * @param httpCallback Callback to be called before and after the HTTP call. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - super(config, httpClient, authManagers, httpCallback); - } - - /** - * Creates an outbound phone call. - * @param accountId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the CreateCallResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createCall( - final String accountId, - final CreateCallRequest body) throws ApiException, IOException { - HttpRequest request = buildCreateCallRequest(accountId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateCallResponse(context); - } - - /** - * Creates an outbound phone call. - * @param accountId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the CreateCallResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createCallAsync( - final String accountId, - final CreateCallRequest body) { - return makeHttpCallAsync(() -> buildCreateCallRequest(accountId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateCallResponse(context)); - } - - /** - * Builds the HttpRequest object for createCall. - */ - private HttpRequest buildCreateCallRequest( - final String accountId, - final CreateCallRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createCall. - * @return An object of type CreateCallResponse - */ - private ApiResponse handleCreateCallResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - CreateCallResponse result = ApiHelper.deserialize(responseBody, - CreateCallResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns near-realtime metadata about the specified call. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @return Returns the CallState wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getCall( - final String accountId, - final String callId) throws ApiException, IOException { - HttpRequest request = buildGetCallRequest(accountId, callId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetCallResponse(context); - } - - /** - * Returns near-realtime metadata about the specified call. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @return Returns the CallState wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getCallAsync( - final String accountId, - final String callId) { - return makeHttpCallAsync(() -> buildGetCallRequest(accountId, callId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetCallResponse(context)); - } - - /** - * Builds the HttpRequest object for getCall. - */ - private HttpRequest buildGetCallRequest( - final String accountId, - final String callId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getCall. - * @return An object of type CallState - */ - private ApiResponse handleGetCallResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - CallState result = ApiHelper.deserialize(responseBody, - CallState.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Interrupts and replaces an active call's BXML document. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse modifyCall( - final String accountId, - final String callId, - final ModifyCallRequest body) throws ApiException, IOException { - HttpRequest request = buildModifyCallRequest(accountId, callId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleModifyCallResponse(context); - } - - /** - * Interrupts and replaces an active call's BXML document. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> modifyCallAsync( - final String accountId, - final String callId, - final ModifyCallRequest body) { - return makeHttpCallAsync(() -> buildModifyCallRequest(accountId, callId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleModifyCallResponse(context)); - } - - /** - * Builds the HttpRequest object for modifyCall. - */ - private HttpRequest buildModifyCallRequest( - final String accountId, - final String callId, - final ModifyCallRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for modifyCall. - * @return An object of type void - */ - private ApiResponse handleModifyCallResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - -/** - * Interrupts and replaces an active call's BXML document. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: Needs to be a valid xml string - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse modifyCallBxml( - final String accountId, - final String callId, - final String body) throws ApiException, IOException { - HttpRequest request = buildModifyCallBxmlRequest(accountId, callId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleModifyCallBxmlResponse(context); - } - - /** - * Interrupts and replaces an active call's BXML document. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: valid xml string - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> modifyCallBxmlAsync( - final String accountId, - final String callId, - final String body) { - return makeHttpCallAsync(() -> buildModifyCallBxmlRequest(accountId, callId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleModifyCallBxmlResponse(context)); - } - - /** - * Builds the HttpRequest object for modifyCallBxml. - */ - private HttpRequest buildModifyCallBxmlRequest( - final String accountId, - final String callId, - final String body) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/bxml"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/xml"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, body); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for modifyCallBxml. - * @return An object of type void - */ - private ApiResponse handleModifyCallBxmlResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/xml`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - - /** - * Pauses or resumes a recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse modifyCallRecordingState( - final String accountId, - final String callId, - final ModifyCallRecordingRequest body) throws ApiException, IOException { - HttpRequest request = buildModifyCallRecordingStateRequest(accountId, callId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleModifyCallRecordingStateResponse(context); - } - - /** - * Pauses or resumes a recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> modifyCallRecordingStateAsync( - final String accountId, - final String callId, - final ModifyCallRecordingRequest body) { - return makeHttpCallAsync(() -> buildModifyCallRecordingStateRequest(accountId, callId, - body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleModifyCallRecordingStateResponse(context)); - } - - /** - * Builds the HttpRequest object for modifyCallRecordingState. - */ - private HttpRequest buildModifyCallRecordingStateRequest( - final String accountId, - final String callId, - final ModifyCallRecordingRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recording"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for modifyCallRecordingState. - * @return An object of type void - */ - private ApiResponse handleModifyCallRecordingStateResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified call. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @return Returns the List of CallRecordingMetadata wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> getCallRecordings( - final String accountId, - final String callId) throws ApiException, IOException { - HttpRequest request = buildGetCallRecordingsRequest(accountId, callId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetCallRecordingsResponse(context); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified call. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @return Returns the List of CallRecordingMetadata wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> getCallRecordingsAsync( - final String accountId, - final String callId) { - return makeHttpCallAsync(() -> buildGetCallRecordingsRequest(accountId, callId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetCallRecordingsResponse(context)); - } - - /** - * Builds the HttpRequest object for getCallRecordings. - */ - private HttpRequest buildGetCallRecordingsRequest( - final String accountId, - final String callId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getCallRecordings. - * @return An object of type List of CallRecordingMetadata - */ - private ApiResponse> handleGetCallRecordingsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - CallRecordingMetadata[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns metadata for the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the CallRecordingMetadata wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getCallRecording( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildGetCallRecordingRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetCallRecordingResponse(context); - } - - /** - * Returns metadata for the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the CallRecordingMetadata wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getCallRecordingAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildGetCallRecordingRequest(accountId, callId, recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, true)), - context -> handleGetCallRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for getCallRecording. - */ - private HttpRequest buildGetCallRecordingRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getCallRecording. - * @return An object of type CallRecordingMetadata - */ - private ApiResponse handleGetCallRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - CallRecordingMetadata result = ApiHelper.deserialize(responseBody, - CallRecordingMetadata.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Deletes the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteRecording( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildDeleteRecordingRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteRecordingResponse(context); - } - - /** - * Deletes the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteRecordingAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildDeleteRecordingRequest(accountId, callId, recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteRecording. - */ - private HttpRequest buildDeleteRecordingRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteRecording. - * @return An object of type void - */ - private ApiResponse handleDeleteRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Downloads the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the DynamicResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getDownloadCallRecording( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildGetDownloadCallRecordingRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, true); - HttpContext context = new HttpContext(request, response); - - return handleGetDownloadCallRecordingResponse(context); - } - - /** - * Downloads the specified recording. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the DynamicResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getDownloadCallRecordingAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildGetDownloadCallRecordingRequest(accountId, callId, - recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, true)), - context -> handleGetDownloadCallRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for getDownloadCallRecording. - */ - private HttpRequest buildGetDownloadCallRecordingRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getDownloadCallRecording. - * @return An object of type DynamicResponse - */ - private ApiResponse handleGetDownloadCallRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - DynamicResponse result = new DynamicResponse(response); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Deletes the specified recording's media. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteRecordingMedia( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildDeleteRecordingMediaRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteRecordingMediaResponse(context); - } - - /** - * Deletes the specified recording's media. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteRecordingMediaAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildDeleteRecordingMediaRequest(accountId, callId, - recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteRecordingMediaResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteRecordingMedia. - */ - private HttpRequest buildDeleteRecordingMediaRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/media"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteRecordingMedia. - * @return An object of type void - */ - private ApiResponse handleDeleteRecordingMediaResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Downloads the specified transcription. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the TranscriptionResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getCallTranscription( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildGetCallTranscriptionRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetCallTranscriptionResponse(context); - } - - /** - * Downloads the specified transcription. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the TranscriptionResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getCallTranscriptionAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildGetCallTranscriptionRequest(accountId, callId, - recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetCallTranscriptionResponse(context)); - } - - /** - * Builds the HttpRequest object for getCallTranscription. - */ - private HttpRequest buildGetCallTranscriptionRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getCallTranscription. - * @return An object of type TranscriptionResponse - */ - private ApiResponse handleGetCallTranscriptionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - TranscriptionResponse result = ApiHelper.deserialize(responseBody, - TranscriptionResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Requests that the specified recording be transcribed. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @param body Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createTranscribeCallRecording( - final String accountId, - final String callId, - final String recordingId, - final TranscribeRecordingRequest body) throws ApiException, IOException { - HttpRequest request = buildCreateTranscribeCallRecordingRequest(accountId, callId, - recordingId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateTranscribeCallRecordingResponse(context); - } - - /** - * Requests that the specified recording be transcribed. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createTranscribeCallRecordingAsync( - final String accountId, - final String callId, - final String recordingId, - final TranscribeRecordingRequest body) { - return makeHttpCallAsync(() -> buildCreateTranscribeCallRecordingRequest(accountId, callId, - recordingId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateTranscribeCallRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for createTranscribeCallRecording. - */ - private HttpRequest buildCreateTranscribeCallRecordingRequest( - final String accountId, - final String callId, - final String recordingId, - final TranscribeRecordingRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createTranscribeCallRecording. - * @return An object of type void - */ - private ApiResponse handleCreateTranscribeCallRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 410) { - throw new ApiErrorException( - "The media for this recording has been deleted, so we can't transcribe it", - context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Deletes the specified recording's transcription. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteCallTranscription( - final String accountId, - final String callId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildDeleteCallTranscriptionRequest(accountId, callId, recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteCallTranscriptionResponse(context); - } - - /** - * Deletes the specified recording's transcription. - * @param accountId Required parameter: Example: - * @param callId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteCallTranscriptionAsync( - final String accountId, - final String callId, - final String recordingId) { - return makeHttpCallAsync(() -> buildDeleteCallTranscriptionRequest(accountId, callId, - recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteCallTranscriptionResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteCallTranscription. - */ - private HttpRequest buildDeleteCallTranscriptionRequest( - final String accountId, - final String callId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/calls/{callId}/recordings/{recordingId}/transcription"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteCallTranscription. - * @return An object of type void - */ - private ApiResponse handleDeleteCallTranscriptionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Returns information about the conferences in the account. - * @param accountId Required parameter: Example: - * @param name Optional parameter: Example: - * @param minCreatedTime Optional parameter: Example: - * @param maxCreatedTime Optional parameter: Example: - * @param pageSize Optional parameter: Example: 1000 - * @param pageToken Optional parameter: Example: - * @return Returns the List of ConferenceState wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> getConferences( - final String accountId, - final String name, - final String minCreatedTime, - final String maxCreatedTime, - final Integer pageSize, - final String pageToken) throws ApiException, IOException { - HttpRequest request = buildGetConferencesRequest(accountId, name, minCreatedTime, - maxCreatedTime, pageSize, pageToken); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetConferencesResponse(context); - } - - /** - * Returns information about the conferences in the account. - * @param accountId Required parameter: Example: - * @param name Optional parameter: Example: - * @param minCreatedTime Optional parameter: Example: - * @param maxCreatedTime Optional parameter: Example: - * @param pageSize Optional parameter: Example: 1000 - * @param pageToken Optional parameter: Example: - * @return Returns the List of ConferenceState wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> getConferencesAsync( - final String accountId, - final String name, - final String minCreatedTime, - final String maxCreatedTime, - final Integer pageSize, - final String pageToken) { - return makeHttpCallAsync(() -> buildGetConferencesRequest(accountId, name, minCreatedTime, - maxCreatedTime, pageSize, pageToken), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetConferencesResponse(context)); - } - - /** - * Builds the HttpRequest object for getConferences. - */ - private HttpRequest buildGetConferencesRequest( - final String accountId, - final String name, - final String minCreatedTime, - final String maxCreatedTime, - final Integer pageSize, - final String pageToken) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all query parameters - Map queryParameters = new HashMap<>(); - queryParameters.put("name", name); - queryParameters.put("minCreatedTime", minCreatedTime); - queryParameters.put("maxCreatedTime", maxCreatedTime); - queryParameters.put("pageSize", - (pageSize != null) ? pageSize : 1000); - queryParameters.put("pageToken", pageToken); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters, - null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getConferences. - * @return An object of type List of ConferenceState - */ - private ApiResponse> handleGetConferencesResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - ConferenceState[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns information about the specified conference. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @return Returns the ConferenceState wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getConference( - final String accountId, - final String conferenceId) throws ApiException, IOException { - HttpRequest request = buildGetConferenceRequest(accountId, conferenceId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetConferenceResponse(context); - } - - /** - * Returns information about the specified conference. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @return Returns the ConferenceState wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getConferenceAsync( - final String accountId, - final String conferenceId) { - return makeHttpCallAsync(() -> buildGetConferenceRequest(accountId, conferenceId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetConferenceResponse(context)); - } - - /** - * Builds the HttpRequest object for getConference. - */ - private HttpRequest buildGetConferenceRequest( - final String accountId, - final String conferenceId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getConference. - * @return An object of type ConferenceState - */ - private ApiResponse handleGetConferenceResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - ConferenceState result = ApiHelper.deserialize(responseBody, - ConferenceState.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Modify the conference state. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param body Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse modifyConference( - final String accountId, - final String conferenceId, - final ModifyConferenceRequest body) throws ApiException, IOException { - HttpRequest request = buildModifyConferenceRequest(accountId, conferenceId, body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleModifyConferenceResponse(context); - } - - /** - * Modify the conference state. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> modifyConferenceAsync( - final String accountId, - final String conferenceId, - final ModifyConferenceRequest body) { - return makeHttpCallAsync(() -> buildModifyConferenceRequest(accountId, conferenceId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleModifyConferenceResponse(context)); - } - - /** - * Builds the HttpRequest object for modifyConference. - */ - private HttpRequest buildModifyConferenceRequest( - final String accountId, - final String conferenceId, - final ModifyConferenceRequest body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for modifyConference. - * @return An object of type void - */ - private ApiResponse handleModifyConferenceResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Updates settings for a particular conference member. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse modifyConferenceMember( - final String accountId, - final String conferenceId, - final String callId, - final ConferenceMemberState body) throws ApiException, IOException { - HttpRequest request = buildModifyConferenceMemberRequest(accountId, conferenceId, callId, - body); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleModifyConferenceMemberResponse(context); - } - - /** - * Updates settings for a particular conference member. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param callId Required parameter: Example: - * @param body Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> modifyConferenceMemberAsync( - final String accountId, - final String conferenceId, - final String callId, - final ConferenceMemberState body) { - return makeHttpCallAsync(() -> buildModifyConferenceMemberRequest(accountId, conferenceId, - callId, body), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleModifyConferenceMemberResponse(context)); - } - - /** - * Builds the HttpRequest object for modifyConferenceMember. - */ - private HttpRequest buildModifyConferenceMemberRequest( - final String accountId, - final String conferenceId, - final String callId, - final ConferenceMemberState body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{callId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - templateParameters.put("callId", - new SimpleEntry(callId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for modifyConferenceMember. - * @return An object of type void - */ - private ApiResponse handleModifyConferenceMemberResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Returns information about the specified conference member. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param memberId Required parameter: Example: - * @return Returns the ConferenceMemberState wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getConferenceMember( - final String accountId, - final String conferenceId, - final String memberId) throws ApiException, IOException { - HttpRequest request = buildGetConferenceMemberRequest(accountId, conferenceId, memberId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetConferenceMemberResponse(context); - } - - /** - * Returns information about the specified conference member. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param memberId Required parameter: Example: - * @return Returns the ConferenceMemberState wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getConferenceMemberAsync( - final String accountId, - final String conferenceId, - final String memberId) { - return makeHttpCallAsync(() -> buildGetConferenceMemberRequest(accountId, conferenceId, - memberId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetConferenceMemberResponse(context)); - } - - /** - * Builds the HttpRequest object for getConferenceMember. - */ - private HttpRequest buildGetConferenceMemberRequest( - final String accountId, - final String conferenceId, - final String memberId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}/members/{memberId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - templateParameters.put("memberId", - new SimpleEntry(memberId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getConferenceMember. - * @return An object of type ConferenceMemberState - */ - private ApiResponse handleGetConferenceMemberResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - ConferenceMemberState result = ApiHelper.deserialize(responseBody, - ConferenceMemberState.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified conference. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @return Returns the List of ConferenceRecordingMetadata wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> getConferenceRecordings( - final String accountId, - final String conferenceId) throws ApiException, IOException { - HttpRequest request = buildGetConferenceRecordingsRequest(accountId, conferenceId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetConferenceRecordingsResponse(context); - } - - /** - * Returns a (potentially empty) list of metadata for the recordings that took place during the - * specified conference. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @return Returns the List of ConferenceRecordingMetadata wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> getConferenceRecordingsAsync( - final String accountId, - final String conferenceId) { - return makeHttpCallAsync(() -> buildGetConferenceRecordingsRequest(accountId, conferenceId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetConferenceRecordingsResponse(context)); - } - - /** - * Builds the HttpRequest object for getConferenceRecordings. - */ - private HttpRequest buildGetConferenceRecordingsRequest( - final String accountId, - final String conferenceId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getConferenceRecordings. - * @return An object of type List of ConferenceRecordingMetadata - */ - private ApiResponse> handleGetConferenceRecordingsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - ConferenceRecordingMetadata[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns metadata for the specified recording. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the CallRecordingMetadata wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getConferenceRecording( - final String accountId, - final String conferenceId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildGetConferenceRecordingRequest(accountId, conferenceId, - recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetConferenceRecordingResponse(context); - } - - /** - * Returns metadata for the specified recording. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the CallRecordingMetadata wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getConferenceRecordingAsync( - final String accountId, - final String conferenceId, - final String recordingId) { - return makeHttpCallAsync(() -> buildGetConferenceRecordingRequest(accountId, conferenceId, - recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetConferenceRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for getConferenceRecording. - */ - private HttpRequest buildGetConferenceRecordingRequest( - final String accountId, - final String conferenceId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getConferenceRecording. - * @return An object of type CallRecordingMetadata - */ - private ApiResponse handleGetConferenceRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - CallRecordingMetadata result = ApiHelper.deserialize(responseBody, - CallRecordingMetadata.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Downloads the specified recording. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the DynamicResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getDownloadConferenceRecording( - final String accountId, - final String conferenceId, - final String recordingId) throws ApiException, IOException { - HttpRequest request = buildGetDownloadConferenceRecordingRequest(accountId, conferenceId, - recordingId); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetDownloadConferenceRecordingResponse(context); - } - - /** - * Downloads the specified recording. - * @param accountId Required parameter: Example: - * @param conferenceId Required parameter: Example: - * @param recordingId Required parameter: Example: - * @return Returns the DynamicResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getDownloadConferenceRecordingAsync( - final String accountId, - final String conferenceId, - final String recordingId) { - return makeHttpCallAsync(() -> buildGetDownloadConferenceRecordingRequest(accountId, - conferenceId, recordingId), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetDownloadConferenceRecordingResponse(context)); - } - - /** - * Builds the HttpRequest object for getDownloadConferenceRecording. - */ - private HttpRequest buildGetDownloadConferenceRecordingRequest( - final String accountId, - final String conferenceId, - final String recordingId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("conferenceId", - new SimpleEntry(conferenceId, false)); - templateParameters.put("recordingId", - new SimpleEntry(recordingId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getDownloadConferenceRecording. - * @return An object of type DynamicResponse - */ - private ApiResponse handleGetDownloadConferenceRecordingResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - DynamicResponse result = new DynamicResponse(response); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Returns a list of metadata for the recordings associated with the specified account. The list - * can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list - * is capped at 1000 entries and may be empty if no recordings match the specified criteria. - * @param accountId Required parameter: Example: - * @param from Optional parameter: Example: - * @param to Optional parameter: Example: - * @param minStartTime Optional parameter: Example: - * @param maxStartTime Optional parameter: Example: - * @return Returns the List of CallRecordingMetadata wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> getQueryCallRecordings( - final String accountId, - final String from, - final String to, - final String minStartTime, - final String maxStartTime) throws ApiException, IOException { - HttpRequest request = buildGetQueryCallRecordingsRequest(accountId, from, to, minStartTime, - maxStartTime); - authManagers.get("voice").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetQueryCallRecordingsResponse(context); - } - - /** - * Returns a list of metadata for the recordings associated with the specified account. The list - * can be filtered by the optional from, to, minStartTime, and maxStartTime arguments. The list - * is capped at 1000 entries and may be empty if no recordings match the specified criteria. - * @param accountId Required parameter: Example: - * @param from Optional parameter: Example: - * @param to Optional parameter: Example: - * @param minStartTime Optional parameter: Example: - * @param maxStartTime Optional parameter: Example: - * @return Returns the List of CallRecordingMetadata wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> getQueryCallRecordingsAsync( - final String accountId, - final String from, - final String to, - final String minStartTime, - final String maxStartTime) { - return makeHttpCallAsync(() -> buildGetQueryCallRecordingsRequest(accountId, from, to, - minStartTime, maxStartTime), - req -> authManagers.get("voice").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetQueryCallRecordingsResponse(context)); - } - - /** - * Builds the HttpRequest object for getQueryCallRecordings. - */ - private HttpRequest buildGetQueryCallRecordingsRequest( - final String accountId, - final String from, - final String to, - final String minStartTime, - final String maxStartTime) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.VOICEDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/api/v2/accounts/{accountId}/recordings"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all query parameters - Map queryParameters = new HashMap<>(); - queryParameters.put("from", from); - queryParameters.put("to", to); - queryParameters.put("minStartTime", minStartTime); - queryParameters.put("maxStartTime", maxStartTime); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, queryParameters, - null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getQueryCallRecordings. - * @return An object of type List of CallRecordingMetadata - */ - private ApiResponse> handleGetQueryCallRecordingsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiErrorException( - "Something's not quite right... Your request is invalid. Please fix it before trying again.", - context); - } - if (responseCode == 401) { - throw new ApiException( - "Your credentials are invalid. Please use your Bandwidth dashboard credentials to authenticate to the API.", - context); - } - if (responseCode == 403) { - throw new ApiErrorException("User unauthorized to perform this action.", context); - } - if (responseCode == 404) { - throw new ApiErrorException( - "The resource specified cannot be found or does not belong to you.", context); - } - if (responseCode == 415) { - throw new ApiErrorException( - "We don't support that media type. If a request body is required, please send it to us as `application/json`.", - context); - } - if (responseCode == 429) { - throw new ApiErrorException( - "You're sending requests to this endpoint too frequently. Please slow your request rate down and try again.", - context); - } - if (responseCode == 500) { - throw new ApiErrorException("Something unexpected happened. Please try again.", - context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - CallRecordingMetadata[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - -} diff --git a/src/main/java/com/bandwidth/voice/exceptions/ApiErrorException.java b/src/main/java/com/bandwidth/voice/exceptions/ApiErrorException.java deleted file mode 100644 index d7e10d9c..00000000 --- a/src/main/java/com/bandwidth/voice/exceptions/ApiErrorException.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ApiErrorException type. - */ -public class ApiErrorException - extends ApiException { - private static final long serialVersionUID = -7594457514726278096L; - private String type; - private String description; - private String id; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public ApiErrorException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Type. - * @return Returns the String - */ - @JsonGetter("type") - public String getType() { - return this.type; - } - - /** - * Setter for Type. - * @param type Value for String - */ - @JsonSetter("type") - private void setType(String type) { - this.type = type; - } - - /** - * Getter for Description. - * @return Returns the String - */ - @JsonGetter("description") - public String getDescription() { - return this.description; - } - - /** - * Setter for Description. - * @param description Value for String - */ - @JsonSetter("description") - private void setDescription(String description) { - this.description = description; - } - - /** - * Getter for Id. - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return this.id; - } - - /** - * Setter for Id. - * @param id Value for String - */ - @JsonSetter("id") - private void setId(String id) { - this.id = id; - } -} diff --git a/src/main/java/com/bandwidth/voice/models/AnswerFallbackMethodEnum.java b/src/main/java/com/bandwidth/voice/models/AnswerFallbackMethodEnum.java deleted file mode 100644 index 3b020289..00000000 --- a/src/main/java/com/bandwidth/voice/models/AnswerFallbackMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * AnswerFallbackMethodEnum to be used. - */ -public enum AnswerFallbackMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static AnswerFallbackMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of AnswerFallbackMethodEnum values to list of string values. - * @param toConvert The list of AnswerFallbackMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (AnswerFallbackMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/AnswerMethodEnum.java b/src/main/java/com/bandwidth/voice/models/AnswerMethodEnum.java deleted file mode 100644 index 3478e51a..00000000 --- a/src/main/java/com/bandwidth/voice/models/AnswerMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * AnswerMethodEnum to be used. - */ -public enum AnswerMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static AnswerMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of AnswerMethodEnum values to list of string values. - * @param toConvert The list of AnswerMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (AnswerMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/CallCallback.java b/src/main/java/com/bandwidth/voice/models/CallCallback.java deleted file mode 100644 index 6219ed55..00000000 --- a/src/main/java/com/bandwidth/voice/models/CallCallback.java +++ /dev/null @@ -1,1129 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for CallCallback type. - */ -public class CallCallback { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String eventType; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String eventTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String direction; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String startTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String answerTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String transferCallerId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String transferTo; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String cause; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String errorMessage; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String errorId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String endTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String digit; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String parentCallId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String recordingId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String duration; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String fileFormat; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mediaUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer channels; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String digits; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String terminatingDigit; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Transcription transcription; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Diversion diversion; - - /** - * Default constructor. - */ - public CallCallback() { - } - - /** - * Initialization constructor. - * @param eventType String value for eventType. - * @param eventTime String value for eventTime. - * @param accountId String value for accountId. - * @param applicationId String value for applicationId. - * @param from String value for from. - * @param to String value for to. - * @param direction String value for direction. - * @param callId String value for callId. - * @param callUrl String value for callUrl. - * @param startTime String value for startTime. - * @param answerTime String value for answerTime. - * @param transferCallerId String value for transferCallerId. - * @param transferTo String value for transferTo. - * @param cause String value for cause. - * @param errorMessage String value for errorMessage. - * @param errorId String value for errorId. - * @param endTime String value for endTime. - * @param digit String value for digit. - * @param parentCallId String value for parentCallId. - * @param recordingId String value for recordingId. - * @param duration String value for duration. - * @param fileFormat String value for fileFormat. - * @param mediaUrl String value for mediaUrl. - * @param tag String value for tag. - * @param channels Integer value for channels. - * @param status String value for status. - * @param digits String value for digits. - * @param terminatingDigit String value for terminatingDigit. - * @param transcription Transcription value for transcription. - * @param diversion Diversion value for diversion. - */ - public CallCallback( - String eventType, - String eventTime, - String accountId, - String applicationId, - String from, - String to, - String direction, - String callId, - String callUrl, - String startTime, - String answerTime, - String transferCallerId, - String transferTo, - String cause, - String errorMessage, - String errorId, - String endTime, - String digit, - String parentCallId, - String recordingId, - String duration, - String fileFormat, - String mediaUrl, - String tag, - Integer channels, - String status, - String digits, - String terminatingDigit, - Transcription transcription, - Diversion diversion) { - this.eventType = eventType; - this.eventTime = eventTime; - this.accountId = accountId; - this.applicationId = applicationId; - this.from = from; - this.to = to; - this.direction = direction; - this.callId = callId; - this.callUrl = callUrl; - this.startTime = startTime; - this.answerTime = answerTime; - this.transferCallerId = transferCallerId; - this.transferTo = transferTo; - this.cause = cause; - this.errorMessage = errorMessage; - this.errorId = errorId; - this.endTime = endTime; - this.digit = digit; - this.parentCallId = parentCallId; - this.recordingId = recordingId; - this.duration = duration; - this.fileFormat = fileFormat; - this.mediaUrl = mediaUrl; - this.tag = tag; - this.channels = channels; - this.status = status; - this.digits = digits; - this.terminatingDigit = terminatingDigit; - this.transcription = transcription; - this.diversion = diversion; - } - - /** - * Getter for EventType. - * @return Returns the String - */ - @JsonGetter("eventType") - public String getEventType() { - return eventType; - } - - /** - * Setter for EventType. - * @param eventType Value for String - */ - @JsonSetter("eventType") - public void setEventType(String eventType) { - this.eventType = eventType; - } - - /** - * Getter for EventTime. - * @return Returns the String - */ - @JsonGetter("eventTime") - public String getEventTime() { - return eventTime; - } - - /** - * Setter for EventTime. - * @param eventTime Value for String - */ - @JsonSetter("eventTime") - public void setEventTime(String eventTime) { - this.eventTime = eventTime; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for ApplicationId. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for From. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for Direction. - * @return Returns the String - */ - @JsonGetter("direction") - public String getDirection() { - return direction; - } - - /** - * Setter for Direction. - * @param direction Value for String - */ - @JsonSetter("direction") - public void setDirection(String direction) { - this.direction = direction; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Getter for CallUrl. - * @return Returns the String - */ - @JsonGetter("callUrl") - public String getCallUrl() { - return callUrl; - } - - /** - * Setter for CallUrl. - * @param callUrl Value for String - */ - @JsonSetter("callUrl") - public void setCallUrl(String callUrl) { - this.callUrl = callUrl; - } - - /** - * Getter for StartTime. - * @return Returns the String - */ - @JsonGetter("startTime") - public String getStartTime() { - return startTime; - } - - /** - * Setter for StartTime. - * @param startTime Value for String - */ - @JsonSetter("startTime") - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - /** - * Getter for AnswerTime. - * @return Returns the String - */ - @JsonGetter("answerTime") - public String getAnswerTime() { - return answerTime; - } - - /** - * Setter for AnswerTime. - * @param answerTime Value for String - */ - @JsonSetter("answerTime") - public void setAnswerTime(String answerTime) { - this.answerTime = answerTime; - } - - /** - * Getter for TransferCallerId. - * @return Returns the String - */ - @JsonGetter("transferCallerId") - public String getTransferCallerId() { - return transferCallerId; - } - - /** - * Setter for TransferCallerId. - * @param transferCallerId Value for String - */ - @JsonSetter("transferCallerId") - public void setTransferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; - } - - /** - * Getter for TransferTo. - * @return Returns the String - */ - @JsonGetter("transferTo") - public String getTransferTo() { - return transferTo; - } - - /** - * Setter for TransferTo. - * @param transferTo Value for String - */ - @JsonSetter("transferTo") - public void setTransferTo(String transferTo) { - this.transferTo = transferTo; - } - - /** - * Getter for Cause. - * @return Returns the String - */ - @JsonGetter("cause") - public String getCause() { - return cause; - } - - /** - * Setter for Cause. - * @param cause Value for String - */ - @JsonSetter("cause") - public void setCause(String cause) { - this.cause = cause; - } - - /** - * Getter for ErrorMessage. - * @return Returns the String - */ - @JsonGetter("errorMessage") - public String getErrorMessage() { - return errorMessage; - } - - /** - * Setter for ErrorMessage. - * @param errorMessage Value for String - */ - @JsonSetter("errorMessage") - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - /** - * Getter for ErrorId. - * @return Returns the String - */ - @JsonGetter("errorId") - public String getErrorId() { - return errorId; - } - - /** - * Setter for ErrorId. - * @param errorId Value for String - */ - @JsonSetter("errorId") - public void setErrorId(String errorId) { - this.errorId = errorId; - } - - /** - * Getter for EndTime. - * @return Returns the String - */ - @JsonGetter("endTime") - public String getEndTime() { - return endTime; - } - - /** - * Setter for EndTime. - * @param endTime Value for String - */ - @JsonSetter("endTime") - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - /** - * Getter for Digit. - * @return Returns the String - */ - @JsonGetter("digit") - public String getDigit() { - return digit; - } - - /** - * Setter for Digit. - * @param digit Value for String - */ - @JsonSetter("digit") - public void setDigit(String digit) { - this.digit = digit; - } - - /** - * Getter for ParentCallId. - * @return Returns the String - */ - @JsonGetter("parentCallId") - public String getParentCallId() { - return parentCallId; - } - - /** - * Setter for ParentCallId. - * @param parentCallId Value for String - */ - @JsonSetter("parentCallId") - public void setParentCallId(String parentCallId) { - this.parentCallId = parentCallId; - } - - /** - * Getter for RecordingId. - * @return Returns the String - */ - @JsonGetter("recordingId") - public String getRecordingId() { - return recordingId; - } - - /** - * Setter for RecordingId. - * @param recordingId Value for String - */ - @JsonSetter("recordingId") - public void setRecordingId(String recordingId) { - this.recordingId = recordingId; - } - - /** - * Getter for Duration. - * @return Returns the String - */ - @JsonGetter("duration") - public String getDuration() { - return duration; - } - - /** - * Setter for Duration. - * @param duration Value for String - */ - @JsonSetter("duration") - public void setDuration(String duration) { - this.duration = duration; - } - - /** - * Getter for FileFormat. - * @return Returns the String - */ - @JsonGetter("fileFormat") - public String getFileFormat() { - return fileFormat; - } - - /** - * Setter for FileFormat. - * @param fileFormat Value for String - */ - @JsonSetter("fileFormat") - public void setFileFormat(String fileFormat) { - this.fileFormat = fileFormat; - } - - /** - * Getter for MediaUrl. - * @return Returns the String - */ - @JsonGetter("mediaUrl") - public String getMediaUrl() { - return mediaUrl; - } - - /** - * Setter for MediaUrl. - * @param mediaUrl Value for String - */ - @JsonSetter("mediaUrl") - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Getter for Channels. - * @return Returns the Integer - */ - @JsonGetter("channels") - public Integer getChannels() { - return channels; - } - - /** - * Setter for Channels. - * @param channels Value for Integer - */ - @JsonSetter("channels") - public void setChannels(Integer channels) { - this.channels = channels; - } - - /** - * Getter for Status. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for Digits. - * @return Returns the String - */ - @JsonGetter("digits") - public String getDigits() { - return digits; - } - - /** - * Setter for Digits. - * @param digits Value for String - */ - @JsonSetter("digits") - public void setDigits(String digits) { - this.digits = digits; - } - - /** - * Getter for TerminatingDigit. - * @return Returns the String - */ - @JsonGetter("terminatingDigit") - public String getTerminatingDigit() { - return terminatingDigit; - } - - /** - * Setter for TerminatingDigit. - * @param terminatingDigit Value for String - */ - @JsonSetter("terminatingDigit") - public void setTerminatingDigit(String terminatingDigit) { - this.terminatingDigit = terminatingDigit; - } - - /** - * Getter for Transcription. - * @return Returns the Transcription - */ - @JsonGetter("transcription") - public Transcription getTranscription() { - return transcription; - } - - /** - * Setter for Transcription. - * @param transcription Value for Transcription - */ - @JsonSetter("transcription") - public void setTranscription(Transcription transcription) { - this.transcription = transcription; - } - - /** - * Getter for Diversion. - * @return Returns the Diversion - */ - @JsonGetter("diversion") - public Diversion getDiversion() { - return diversion; - } - - /** - * Setter for Diversion. - * @param diversion Value for Diversion - */ - @JsonSetter("diversion") - public void setDiversion(Diversion diversion) { - this.diversion = diversion; - } - - /** - * Converts this CallCallback into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "CallCallback [" + "eventType=" + eventType + ", eventTime=" + eventTime - + ", accountId=" + accountId + ", applicationId=" + applicationId + ", from=" + from - + ", to=" + to + ", direction=" + direction + ", callId=" + callId + ", callUrl=" - + callUrl + ", startTime=" + startTime + ", answerTime=" + answerTime - + ", transferCallerId=" + transferCallerId + ", transferTo=" + transferTo - + ", cause=" + cause + ", errorMessage=" + errorMessage + ", errorId=" + errorId - + ", endTime=" + endTime + ", digit=" + digit + ", parentCallId=" + parentCallId - + ", recordingId=" + recordingId + ", duration=" + duration + ", fileFormat=" - + fileFormat + ", mediaUrl=" + mediaUrl + ", tag=" + tag + ", channels=" + channels - + ", status=" + status + ", digits=" + digits + ", terminatingDigit=" - + terminatingDigit + ", transcription=" + transcription + ", diversion=" + diversion - + "]"; - } - - /** - * Builds a new {@link CallCallback.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link CallCallback.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .eventType(getEventType()) - .eventTime(getEventTime()) - .accountId(getAccountId()) - .applicationId(getApplicationId()) - .from(getFrom()) - .to(getTo()) - .direction(getDirection()) - .callId(getCallId()) - .callUrl(getCallUrl()) - .startTime(getStartTime()) - .answerTime(getAnswerTime()) - .transferCallerId(getTransferCallerId()) - .transferTo(getTransferTo()) - .cause(getCause()) - .errorMessage(getErrorMessage()) - .errorId(getErrorId()) - .endTime(getEndTime()) - .digit(getDigit()) - .parentCallId(getParentCallId()) - .recordingId(getRecordingId()) - .duration(getDuration()) - .fileFormat(getFileFormat()) - .mediaUrl(getMediaUrl()) - .tag(getTag()) - .channels(getChannels()) - .status(getStatus()) - .digits(getDigits()) - .terminatingDigit(getTerminatingDigit()) - .transcription(getTranscription()) - .diversion(getDiversion()); - return builder; - } - - /** - * Class to build instances of {@link CallCallback}. - */ - public static class Builder { - private String eventType; - private String eventTime; - private String accountId; - private String applicationId; - private String from; - private String to; - private String direction; - private String callId; - private String callUrl; - private String startTime; - private String answerTime; - private String transferCallerId; - private String transferTo; - private String cause; - private String errorMessage; - private String errorId; - private String endTime; - private String digit; - private String parentCallId; - private String recordingId; - private String duration; - private String fileFormat; - private String mediaUrl; - private String tag; - private Integer channels; - private String status; - private String digits; - private String terminatingDigit; - private Transcription transcription; - private Diversion diversion; - - - - /** - * Setter for eventType. - * @param eventType String value for eventType. - * @return Builder - */ - public Builder eventType(String eventType) { - this.eventType = eventType; - return this; - } - - /** - * Setter for eventTime. - * @param eventTime String value for eventTime. - * @return Builder - */ - public Builder eventTime(String eventTime) { - this.eventTime = eventTime; - return this; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for direction. - * @param direction String value for direction. - * @return Builder - */ - public Builder direction(String direction) { - this.direction = direction; - return this; - } - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for callUrl. - * @param callUrl String value for callUrl. - * @return Builder - */ - public Builder callUrl(String callUrl) { - this.callUrl = callUrl; - return this; - } - - /** - * Setter for startTime. - * @param startTime String value for startTime. - * @return Builder - */ - public Builder startTime(String startTime) { - this.startTime = startTime; - return this; - } - - /** - * Setter for answerTime. - * @param answerTime String value for answerTime. - * @return Builder - */ - public Builder answerTime(String answerTime) { - this.answerTime = answerTime; - return this; - } - - /** - * Setter for transferCallerId. - * @param transferCallerId String value for transferCallerId. - * @return Builder - */ - public Builder transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; - return this; - } - - /** - * Setter for transferTo. - * @param transferTo String value for transferTo. - * @return Builder - */ - public Builder transferTo(String transferTo) { - this.transferTo = transferTo; - return this; - } - - /** - * Setter for cause. - * @param cause String value for cause. - * @return Builder - */ - public Builder cause(String cause) { - this.cause = cause; - return this; - } - - /** - * Setter for errorMessage. - * @param errorMessage String value for errorMessage. - * @return Builder - */ - public Builder errorMessage(String errorMessage) { - this.errorMessage = errorMessage; - return this; - } - - /** - * Setter for errorId. - * @param errorId String value for errorId. - * @return Builder - */ - public Builder errorId(String errorId) { - this.errorId = errorId; - return this; - } - - /** - * Setter for endTime. - * @param endTime String value for endTime. - * @return Builder - */ - public Builder endTime(String endTime) { - this.endTime = endTime; - return this; - } - - /** - * Setter for digit. - * @param digit String value for digit. - * @return Builder - */ - public Builder digit(String digit) { - this.digit = digit; - return this; - } - - /** - * Setter for parentCallId. - * @param parentCallId String value for parentCallId. - * @return Builder - */ - public Builder parentCallId(String parentCallId) { - this.parentCallId = parentCallId; - return this; - } - - /** - * Setter for recordingId. - * @param recordingId String value for recordingId. - * @return Builder - */ - public Builder recordingId(String recordingId) { - this.recordingId = recordingId; - return this; - } - - /** - * Setter for duration. - * @param duration String value for duration. - * @return Builder - */ - public Builder duration(String duration) { - this.duration = duration; - return this; - } - - /** - * Setter for fileFormat. - * @param fileFormat String value for fileFormat. - * @return Builder - */ - public Builder fileFormat(String fileFormat) { - this.fileFormat = fileFormat; - return this; - } - - /** - * Setter for mediaUrl. - * @param mediaUrl String value for mediaUrl. - * @return Builder - */ - public Builder mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Setter for channels. - * @param channels Integer value for channels. - * @return Builder - */ - public Builder channels(Integer channels) { - this.channels = channels; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for digits. - * @param digits String value for digits. - * @return Builder - */ - public Builder digits(String digits) { - this.digits = digits; - return this; - } - - /** - * Setter for terminatingDigit. - * @param terminatingDigit String value for terminatingDigit. - * @return Builder - */ - public Builder terminatingDigit(String terminatingDigit) { - this.terminatingDigit = terminatingDigit; - return this; - } - - /** - * Setter for transcription. - * @param transcription Transcription value for transcription. - * @return Builder - */ - public Builder transcription(Transcription transcription) { - this.transcription = transcription; - return this; - } - - /** - * Setter for diversion. - * @param diversion Diversion value for diversion. - * @return Builder - */ - public Builder diversion(Diversion diversion) { - this.diversion = diversion; - return this; - } - - /** - * Builds a new {@link CallCallback} object using the set fields. - * @return {@link CallCallback} - */ - public CallCallback build() { - return new CallCallback(eventType, eventTime, accountId, applicationId, from, to, - direction, callId, callUrl, startTime, answerTime, transferCallerId, transferTo, - cause, errorMessage, errorId, endTime, digit, parentCallId, recordingId, - duration, fileFormat, mediaUrl, tag, channels, status, digits, terminatingDigit, - transcription, diversion); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/CallRecordingMetadata.java b/src/main/java/com/bandwidth/voice/models/CallRecordingMetadata.java deleted file mode 100644 index c3888fef..00000000 --- a/src/main/java/com/bandwidth/voice/models/CallRecordingMetadata.java +++ /dev/null @@ -1,774 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.DateTimeHelper; -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.LocalDateTime; - -/** - * This is a model class for CallRecordingMetadata type. - */ -public class CallRecordingMetadata { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable parentCallId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String recordingId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String transferCallerId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String transferTo; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String duration; - @JsonInclude(JsonInclude.Include.NON_NULL) - private DirectionEnum direction; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer channels; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime startTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime endTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private FileFormatEnum fileFormat; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mediaUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private TranscriptionMetadata transcription; - - /** - * Default constructor. - */ - public CallRecordingMetadata() { - } - - /** - * Initialization constructor. - * @param applicationId String value for applicationId. - * @param accountId String value for accountId. - * @param callId String value for callId. - * @param parentCallId String value for parentCallId. - * @param recordingId String value for recordingId. - * @param to String value for to. - * @param from String value for from. - * @param transferCallerId String value for transferCallerId. - * @param transferTo String value for transferTo. - * @param duration String value for duration. - * @param direction DirectionEnum value for direction. - * @param channels Integer value for channels. - * @param startTime LocalDateTime value for startTime. - * @param endTime LocalDateTime value for endTime. - * @param fileFormat FileFormatEnum value for fileFormat. - * @param status String value for status. - * @param mediaUrl String value for mediaUrl. - * @param transcription TranscriptionMetadata value for transcription. - */ - public CallRecordingMetadata( - String applicationId, - String accountId, - String callId, - String parentCallId, - String recordingId, - String to, - String from, - String transferCallerId, - String transferTo, - String duration, - DirectionEnum direction, - Integer channels, - LocalDateTime startTime, - LocalDateTime endTime, - FileFormatEnum fileFormat, - String status, - String mediaUrl, - TranscriptionMetadata transcription) { - this.applicationId = applicationId; - this.accountId = accountId; - this.callId = callId; - this.parentCallId = OptionalNullable.of(parentCallId); - this.recordingId = recordingId; - this.to = to; - this.from = from; - this.transferCallerId = transferCallerId; - this.transferTo = transferTo; - this.duration = duration; - this.direction = direction; - this.channels = channels; - this.startTime = startTime; - this.endTime = endTime; - this.fileFormat = fileFormat; - this.status = status; - this.mediaUrl = mediaUrl; - this.transcription = transcription; - } - - /** - * Internal initialization constructor. - */ - protected CallRecordingMetadata(String applicationId, String accountId, String callId, - OptionalNullable parentCallId, String recordingId, String to, String from, - String transferCallerId, String transferTo, String duration, DirectionEnum direction, - Integer channels, LocalDateTime startTime, LocalDateTime endTime, - FileFormatEnum fileFormat, String status, String mediaUrl, - TranscriptionMetadata transcription) { - this.applicationId = applicationId; - this.accountId = accountId; - this.callId = callId; - this.parentCallId = parentCallId; - this.recordingId = recordingId; - this.to = to; - this.from = from; - this.transferCallerId = transferCallerId; - this.transferTo = transferTo; - this.duration = duration; - this.direction = direction; - this.channels = channels; - this.startTime = startTime; - this.endTime = endTime; - this.fileFormat = fileFormat; - this.status = status; - this.mediaUrl = mediaUrl; - this.transcription = transcription; - } - - /** - * Getter for ApplicationId. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Internal Getter for ParentCallId. - * @return Returns the Internal String - */ - @JsonGetter("parentCallId") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetParentCallId() { - return this.parentCallId; - } - - /** - * Getter for ParentCallId. - * @return Returns the String - */ - public String getParentCallId() { - return OptionalNullable.getFrom(parentCallId); - } - - /** - * Setter for ParentCallId. - * @param parentCallId Value for String - */ - @JsonSetter("parentCallId") - public void setParentCallId(String parentCallId) { - this.parentCallId = OptionalNullable.of(parentCallId); - } - - /** - * UnSetter for ParentCallId. - */ - public void unsetParentCallId() { - parentCallId = null; - } - - /** - * Getter for RecordingId. - * @return Returns the String - */ - @JsonGetter("recordingId") - public String getRecordingId() { - return recordingId; - } - - /** - * Setter for RecordingId. - * @param recordingId Value for String - */ - @JsonSetter("recordingId") - public void setRecordingId(String recordingId) { - this.recordingId = recordingId; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for From. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for TransferCallerId. - * @return Returns the String - */ - @JsonGetter("transferCallerId") - public String getTransferCallerId() { - return transferCallerId; - } - - /** - * Setter for TransferCallerId. - * @param transferCallerId Value for String - */ - @JsonSetter("transferCallerId") - public void setTransferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; - } - - /** - * Getter for TransferTo. - * @return Returns the String - */ - @JsonGetter("transferTo") - public String getTransferTo() { - return transferTo; - } - - /** - * Setter for TransferTo. - * @param transferTo Value for String - */ - @JsonSetter("transferTo") - public void setTransferTo(String transferTo) { - this.transferTo = transferTo; - } - - /** - * Getter for Duration. - * Format is ISO-8601 - * @return Returns the String - */ - @JsonGetter("duration") - public String getDuration() { - return duration; - } - - /** - * Setter for Duration. - * Format is ISO-8601 - * @param duration Value for String - */ - @JsonSetter("duration") - public void setDuration(String duration) { - this.duration = duration; - } - - /** - * Getter for Direction. - * @return Returns the DirectionEnum - */ - @JsonGetter("direction") - public DirectionEnum getDirection() { - return direction; - } - - /** - * Setter for Direction. - * @param direction Value for DirectionEnum - */ - @JsonSetter("direction") - public void setDirection(DirectionEnum direction) { - this.direction = direction; - } - - /** - * Getter for Channels. - * @return Returns the Integer - */ - @JsonGetter("channels") - public Integer getChannels() { - return channels; - } - - /** - * Setter for Channels. - * @param channels Value for Integer - */ - @JsonSetter("channels") - public void setChannels(Integer channels) { - this.channels = channels; - } - - /** - * Getter for StartTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("startTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getStartTime() { - return startTime; - } - - /** - * Setter for StartTime. - * @param startTime Value for LocalDateTime - */ - @JsonSetter("startTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setStartTime(LocalDateTime startTime) { - this.startTime = startTime; - } - - /** - * Getter for EndTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("endTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getEndTime() { - return endTime; - } - - /** - * Setter for EndTime. - * @param endTime Value for LocalDateTime - */ - @JsonSetter("endTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setEndTime(LocalDateTime endTime) { - this.endTime = endTime; - } - - /** - * Getter for FileFormat. - * @return Returns the FileFormatEnum - */ - @JsonGetter("fileFormat") - public FileFormatEnum getFileFormat() { - return fileFormat; - } - - /** - * Setter for FileFormat. - * @param fileFormat Value for FileFormatEnum - */ - @JsonSetter("fileFormat") - public void setFileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; - } - - /** - * Getter for Status. - * The current status of the recording. Current values are 'processing', 'partial', 'complete', - * 'deleted' and 'error'. Additional states may be added in the future, so your application must - * be tolerant of unknown values. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * The current status of the recording. Current values are 'processing', 'partial', 'complete', - * 'deleted' and 'error'. Additional states may be added in the future, so your application must - * be tolerant of unknown values. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for MediaUrl. - * @return Returns the String - */ - @JsonGetter("mediaUrl") - public String getMediaUrl() { - return mediaUrl; - } - - /** - * Setter for MediaUrl. - * @param mediaUrl Value for String - */ - @JsonSetter("mediaUrl") - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - /** - * Getter for Transcription. - * @return Returns the TranscriptionMetadata - */ - @JsonGetter("transcription") - public TranscriptionMetadata getTranscription() { - return transcription; - } - - /** - * Setter for Transcription. - * @param transcription Value for TranscriptionMetadata - */ - @JsonSetter("transcription") - public void setTranscription(TranscriptionMetadata transcription) { - this.transcription = transcription; - } - - /** - * Converts this CallRecordingMetadata into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "CallRecordingMetadata [" + "applicationId=" + applicationId + ", accountId=" - + accountId + ", callId=" + callId + ", parentCallId=" + parentCallId - + ", recordingId=" + recordingId + ", to=" + to + ", from=" + from - + ", transferCallerId=" + transferCallerId + ", transferTo=" + transferTo - + ", duration=" + duration + ", direction=" + direction + ", channels=" + channels - + ", startTime=" + startTime + ", endTime=" + endTime + ", fileFormat=" + fileFormat - + ", status=" + status + ", mediaUrl=" + mediaUrl + ", transcription=" - + transcription + "]"; - } - - /** - * Builds a new {@link CallRecordingMetadata.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link CallRecordingMetadata.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .applicationId(getApplicationId()) - .accountId(getAccountId()) - .callId(getCallId()) - .recordingId(getRecordingId()) - .to(getTo()) - .from(getFrom()) - .transferCallerId(getTransferCallerId()) - .transferTo(getTransferTo()) - .duration(getDuration()) - .direction(getDirection()) - .channels(getChannels()) - .startTime(getStartTime()) - .endTime(getEndTime()) - .fileFormat(getFileFormat()) - .status(getStatus()) - .mediaUrl(getMediaUrl()) - .transcription(getTranscription()); - builder.parentCallId = internalGetParentCallId(); - return builder; - } - - /** - * Class to build instances of {@link CallRecordingMetadata}. - */ - public static class Builder { - private String applicationId; - private String accountId; - private String callId; - private OptionalNullable parentCallId; - private String recordingId; - private String to; - private String from; - private String transferCallerId; - private String transferTo; - private String duration; - private DirectionEnum direction; - private Integer channels; - private LocalDateTime startTime; - private LocalDateTime endTime; - private FileFormatEnum fileFormat; - private String status; - private String mediaUrl; - private TranscriptionMetadata transcription; - - - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for parentCallId. - * @param parentCallId String value for parentCallId. - * @return Builder - */ - public Builder parentCallId(String parentCallId) { - this.parentCallId = OptionalNullable.of(parentCallId); - return this; - } - - /** - * UnSetter for parentCallId. - * @return Builder - */ - public Builder unsetParentCallId() { - parentCallId = null; - return this; - } - - /** - * Setter for recordingId. - * @param recordingId String value for recordingId. - * @return Builder - */ - public Builder recordingId(String recordingId) { - this.recordingId = recordingId; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for transferCallerId. - * @param transferCallerId String value for transferCallerId. - * @return Builder - */ - public Builder transferCallerId(String transferCallerId) { - this.transferCallerId = transferCallerId; - return this; - } - - /** - * Setter for transferTo. - * @param transferTo String value for transferTo. - * @return Builder - */ - public Builder transferTo(String transferTo) { - this.transferTo = transferTo; - return this; - } - - /** - * Setter for duration. - * @param duration String value for duration. - * @return Builder - */ - public Builder duration(String duration) { - this.duration = duration; - return this; - } - - /** - * Setter for direction. - * @param direction DirectionEnum value for direction. - * @return Builder - */ - public Builder direction(DirectionEnum direction) { - this.direction = direction; - return this; - } - - /** - * Setter for channels. - * @param channels Integer value for channels. - * @return Builder - */ - public Builder channels(Integer channels) { - this.channels = channels; - return this; - } - - /** - * Setter for startTime. - * @param startTime LocalDateTime value for startTime. - * @return Builder - */ - public Builder startTime(LocalDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * Setter for endTime. - * @param endTime LocalDateTime value for endTime. - * @return Builder - */ - public Builder endTime(LocalDateTime endTime) { - this.endTime = endTime; - return this; - } - - /** - * Setter for fileFormat. - * @param fileFormat FileFormatEnum value for fileFormat. - * @return Builder - */ - public Builder fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for mediaUrl. - * @param mediaUrl String value for mediaUrl. - * @return Builder - */ - public Builder mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * Setter for transcription. - * @param transcription TranscriptionMetadata value for transcription. - * @return Builder - */ - public Builder transcription(TranscriptionMetadata transcription) { - this.transcription = transcription; - return this; - } - - /** - * Builds a new {@link CallRecordingMetadata} object using the set fields. - * @return {@link CallRecordingMetadata} - */ - public CallRecordingMetadata build() { - return new CallRecordingMetadata(applicationId, accountId, callId, parentCallId, - recordingId, to, from, transferCallerId, transferTo, duration, direction, - channels, startTime, endTime, fileFormat, status, mediaUrl, transcription); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/CallState.java b/src/main/java/com/bandwidth/voice/models/CallState.java deleted file mode 100644 index 1aea7566..00000000 --- a/src/main/java/com/bandwidth/voice/models/CallState.java +++ /dev/null @@ -1,945 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.DateTimeHelper; -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * This is a model class for CallState type. - */ -public class CallState { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable parentCallId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String applicationId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String direction; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String state; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable identity; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Map stirShaken; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime startTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime enqueuedTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable endTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable disconnectCause; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable errorMessage; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable errorId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime lastUpdate; - - /** - * Default constructor. - */ - public CallState() { - } - - /** - * Initialization constructor. - * @param callId String value for callId. - * @param parentCallId String value for parentCallId. - * @param applicationId String value for applicationId. - * @param accountId String value for accountId. - * @param to String value for to. - * @param from String value for from. - * @param direction String value for direction. - * @param state String value for state. - * @param identity String value for identity. - * @param stirShaken Map of String, value for stirShaken. - * @param startTime LocalDateTime value for startTime. - * @param enqueuedTime LocalDateTime value for enqueuedTime. - * @param answerTime LocalDateTime value for answerTime. - * @param endTime LocalDateTime value for endTime. - * @param disconnectCause String value for disconnectCause. - * @param errorMessage String value for errorMessage. - * @param errorId String value for errorId. - * @param lastUpdate LocalDateTime value for lastUpdate. - */ - public CallState( - String callId, - String parentCallId, - String applicationId, - String accountId, - String to, - String from, - String direction, - String state, - String identity, - Map stirShaken, - LocalDateTime startTime, - LocalDateTime enqueuedTime, - LocalDateTime answerTime, - LocalDateTime endTime, - String disconnectCause, - String errorMessage, - String errorId, - LocalDateTime lastUpdate) { - this.callId = callId; - this.parentCallId = OptionalNullable.of(parentCallId); - this.applicationId = applicationId; - this.accountId = accountId; - this.to = to; - this.from = from; - this.direction = direction; - this.state = state; - this.identity = OptionalNullable.of(identity); - this.stirShaken = stirShaken; - this.startTime = startTime; - this.enqueuedTime = enqueuedTime; - this.answerTime = OptionalNullable.of(answerTime); - this.endTime = OptionalNullable.of(endTime); - this.disconnectCause = OptionalNullable.of(disconnectCause); - this.errorMessage = OptionalNullable.of(errorMessage); - this.errorId = OptionalNullable.of(errorId); - this.lastUpdate = lastUpdate; - } - - /** - * Internal initialization constructor. - */ - protected CallState(String callId, OptionalNullable parentCallId, String applicationId, - String accountId, String to, String from, String direction, String state, - OptionalNullable identity, Map stirShaken, - LocalDateTime startTime, LocalDateTime enqueuedTime, OptionalNullable answerTime, - OptionalNullable endTime, OptionalNullable disconnectCause, - OptionalNullable errorMessage, OptionalNullable errorId, - LocalDateTime lastUpdate) { - this.callId = callId; - this.parentCallId = parentCallId; - this.applicationId = applicationId; - this.accountId = accountId; - this.to = to; - this.from = from; - this.direction = direction; - this.state = state; - this.identity = identity; - this.stirShaken = stirShaken; - this.startTime = startTime; - this.enqueuedTime = enqueuedTime; - this.answerTime = answerTime; - this.endTime = endTime; - this.disconnectCause = disconnectCause; - this.errorMessage = errorMessage; - this.errorId = errorId; - this.lastUpdate = lastUpdate; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Internal Getter for ParentCallId. - * @return Returns the Internal String - */ - @JsonGetter("parentCallId") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetParentCallId() { - return this.parentCallId; - } - - /** - * Getter for ParentCallId. - * @return Returns the String - */ - public String getParentCallId() { - return OptionalNullable.getFrom(parentCallId); - } - - /** - * Setter for ParentCallId. - * @param parentCallId Value for String - */ - @JsonSetter("parentCallId") - public void setParentCallId(String parentCallId) { - this.parentCallId = OptionalNullable.of(parentCallId); - } - - /** - * UnSetter for ParentCallId. - */ - public void unsetParentCallId() { - parentCallId = null; - } - - /** - * Getter for ApplicationId. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for From. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for Direction. - * @return Returns the String - */ - @JsonGetter("direction") - public String getDirection() { - return direction; - } - - /** - * Setter for Direction. - * @param direction Value for String - */ - @JsonSetter("direction") - public void setDirection(String direction) { - this.direction = direction; - } - - /** - * Getter for State. - * The current state of the call. Current possible values are 'initiated', 'answered' and - * 'disconnected'. Additional states may be added in the future, so your application must be - * tolerant of unknown values. - * @return Returns the String - */ - @JsonGetter("state") - public String getState() { - return state; - } - - /** - * Setter for State. - * The current state of the call. Current possible values are 'initiated', 'answered' and - * 'disconnected'. Additional states may be added in the future, so your application must be - * tolerant of unknown values. - * @param state Value for String - */ - @JsonSetter("state") - public void setState(String state) { - this.state = state; - } - - /** - * Internal Getter for Identity. - * @return Returns the Internal String - */ - @JsonGetter("identity") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetIdentity() { - return this.identity; - } - - /** - * Getter for Identity. - * @return Returns the String - */ - public String getIdentity() { - return OptionalNullable.getFrom(identity); - } - - /** - * Setter for Identity. - * @param identity Value for String - */ - @JsonSetter("identity") - public void setIdentity(String identity) { - this.identity = OptionalNullable.of(identity); - } - - /** - * UnSetter for Identity. - */ - public void unsetIdentity() { - identity = null; - } - - /** - * Getter for StirShaken. - * @return Returns the Map of String, String - */ - @JsonGetter("stirShaken") - public Map getStirShaken() { - return stirShaken; - } - - /** - * Setter for StirShaken. - * @param stirShaken Value for Map of String, String - */ - @JsonSetter("stirShaken") - public void setStirShaken(Map stirShaken) { - this.stirShaken = stirShaken; - } - - /** - * Getter for StartTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("startTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getStartTime() { - return startTime; - } - - /** - * Getter for EnqueuedTime - * @return Returns the LocalDateTime - */ - @JsonGetter("enqueuedTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getEnqueuedTime() { return enqueuedTime; } - - /** - * Setter for StartTime. - * @param startTime Value for LocalDateTime - */ - @JsonSetter("startTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setStartTime(LocalDateTime startTime) { - this.startTime = startTime; - } - - /** - * Setter for EnqueuedTime. - * @param enqueuedTime Value for LocalDateTime - */ - @JsonSetter("enqueuedTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setEnqueuedTime(LocalDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; - } - - /** - * Internal Getter for AnswerTime. - * @return Returns the Internal LocalDateTime - */ - @JsonGetter("answerTime") - @JsonSerialize(using = OptionalNullable.Rfc8601DateTimeSerializer.class) - protected OptionalNullable internalGetAnswerTime() { - return this.answerTime; - } - - /** - * Getter for AnswerTime. - * @return Returns the LocalDateTime - */ - public LocalDateTime getAnswerTime() { - return OptionalNullable.getFrom(answerTime); - } - - /** - * Setter for AnswerTime. - * @param answerTime Value for LocalDateTime - */ - @JsonSetter("answerTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setAnswerTime(LocalDateTime answerTime) { - this.answerTime = OptionalNullable.of(answerTime); - } - - /** - * UnSetter for AnswerTime. - */ - public void unsetAnswerTime() { - answerTime = null; - } - - /** - * Internal Getter for EndTime. - * @return Returns the Internal LocalDateTime - */ - @JsonGetter("endTime") - @JsonSerialize(using = OptionalNullable.Rfc8601DateTimeSerializer.class) - protected OptionalNullable internalGetEndTime() { - return this.endTime; - } - - /** - * Getter for EndTime. - * @return Returns the LocalDateTime - */ - public LocalDateTime getEndTime() { - return OptionalNullable.getFrom(endTime); - } - - /** - * Setter for EndTime. - * @param endTime Value for LocalDateTime - */ - @JsonSetter("endTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setEndTime(LocalDateTime endTime) { - this.endTime = OptionalNullable.of(endTime); - } - - /** - * UnSetter for EndTime. - */ - public void unsetEndTime() { - endTime = null; - } - - /** - * Internal Getter for DisconnectCause. - * The reason the call was disconnected, or null if the call is still active. Current values are - * 'cancel', 'timeout', 'busy', 'rejected', 'hangup', 'invalid-bxml', 'callback-error', - * 'application-error', 'error', 'account-limit', 'node-capacity-exceeded' and 'unknown'. - * Additional causes may be added in the future, so your application must be tolerant of unknown - * values. - * @return Returns the Internal String - */ - @JsonGetter("disconnectCause") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetDisconnectCause() { - return this.disconnectCause; - } - - /** - * Getter for DisconnectCause. - * The reason the call was disconnected, or null if the call is still active. Current values are - * 'cancel', 'timeout', 'busy', 'rejected', 'hangup', 'invalid-bxml', 'callback-error', - * 'application-error', 'error', 'account-limit', 'node-capacity-exceeded' and 'unknown'. - * Additional causes may be added in the future, so your application must be tolerant of unknown - * values. - * @return Returns the String - */ - public String getDisconnectCause() { - return OptionalNullable.getFrom(disconnectCause); - } - - /** - * Setter for DisconnectCause. - * The reason the call was disconnected, or null if the call is still active. Current values are - * 'cancel', 'timeout', 'busy', 'rejected', 'hangup', 'invalid-bxml', 'callback-error', - * 'application-error', 'error', 'account-limit', 'node-capacity-exceeded' and 'unknown'. - * Additional causes may be added in the future, so your application must be tolerant of unknown - * values. - * @param disconnectCause Value for String - */ - @JsonSetter("disconnectCause") - public void setDisconnectCause(String disconnectCause) { - this.disconnectCause = OptionalNullable.of(disconnectCause); - } - - /** - * UnSetter for DisconnectCause. - * The reason the call was disconnected, or null if the call is still active. Current values are - * 'cancel', 'timeout', 'busy', 'rejected', 'hangup', 'invalid-bxml', 'callback-error', - * 'application-error', 'error', 'account-limit', 'node-capacity-exceeded' and 'unknown'. - * Additional causes may be added in the future, so your application must be tolerant of unknown - * values. - */ - public void unsetDisconnectCause() { - disconnectCause = null; - } - - /** - * Internal Getter for ErrorMessage. - * @return Returns the Internal String - */ - @JsonGetter("errorMessage") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetErrorMessage() { - return this.errorMessage; - } - - /** - * Getter for ErrorMessage. - * @return Returns the String - */ - public String getErrorMessage() { - return OptionalNullable.getFrom(errorMessage); - } - - /** - * Setter for ErrorMessage. - * @param errorMessage Value for String - */ - @JsonSetter("errorMessage") - public void setErrorMessage(String errorMessage) { - this.errorMessage = OptionalNullable.of(errorMessage); - } - - /** - * UnSetter for ErrorMessage. - */ - public void unsetErrorMessage() { - errorMessage = null; - } - - /** - * Internal Getter for ErrorId. - * @return Returns the Internal String - */ - @JsonGetter("errorId") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetErrorId() { - return this.errorId; - } - - /** - * Getter for ErrorId. - * @return Returns the String - */ - public String getErrorId() { - return OptionalNullable.getFrom(errorId); - } - - /** - * Setter for ErrorId. - * @param errorId Value for String - */ - @JsonSetter("errorId") - public void setErrorId(String errorId) { - this.errorId = OptionalNullable.of(errorId); - } - - /** - * UnSetter for ErrorId. - */ - public void unsetErrorId() { - errorId = null; - } - - /** - * Getter for LastUpdate. - * @return Returns the LocalDateTime - */ - @JsonGetter("lastUpdate") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getLastUpdate() { - return lastUpdate; - } - - /** - * Setter for LastUpdate. - * @param lastUpdate Value for LocalDateTime - */ - @JsonSetter("lastUpdate") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setLastUpdate(LocalDateTime lastUpdate) { - this.lastUpdate = lastUpdate; - } - - /** - * Converts this CallState into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "CallState [" + "callId=" + callId + ", parentCallId=" + parentCallId - + ", applicationId=" + applicationId + ", accountId=" + accountId + ", to=" + to - + ", from=" + from + ", direction=" + direction + ", state=" + state + ", identity=" - + identity + ", stirShaken=" + stirShaken + ", startTime=" + startTime + ", enqueuedTime=" + enqueuedTime - + ", answerTime=" + answerTime + ", endTime=" + endTime + ", disconnectCause=" - + disconnectCause + ", errorMessage=" + errorMessage + ", errorId=" + errorId - + ", lastUpdate=" + lastUpdate + "]"; - } - - /** - * Builds a new {@link CallState.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link CallState.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .callId(getCallId()) - .applicationId(getApplicationId()) - .accountId(getAccountId()) - .to(getTo()) - .from(getFrom()) - .direction(getDirection()) - .state(getState()) - .stirShaken(getStirShaken()) - .startTime(getStartTime()) - .enqueuedTime(getEnqueuedTime()) - .lastUpdate(getLastUpdate()); - builder.parentCallId = internalGetParentCallId(); - builder.identity = internalGetIdentity(); - builder.answerTime = internalGetAnswerTime(); - builder.endTime = internalGetEndTime(); - builder.disconnectCause = internalGetDisconnectCause(); - builder.errorMessage = internalGetErrorMessage(); - builder.errorId = internalGetErrorId(); - return builder; - } - - /** - * Class to build instances of {@link CallState}. - */ - public static class Builder { - private String callId; - private OptionalNullable parentCallId; - private String applicationId; - private String accountId; - private String to; - private String from; - private String direction; - private String state; - private OptionalNullable identity; - private Map stirShaken; - private LocalDateTime startTime; - private LocalDateTime enqueuedTime; - private OptionalNullable answerTime; - private OptionalNullable endTime; - private OptionalNullable disconnectCause; - private OptionalNullable errorMessage; - private OptionalNullable errorId; - private LocalDateTime lastUpdate; - - - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for parentCallId. - * @param parentCallId String value for parentCallId. - * @return Builder - */ - public Builder parentCallId(String parentCallId) { - this.parentCallId = OptionalNullable.of(parentCallId); - return this; - } - - /** - * UnSetter for parentCallId. - * @return Builder - */ - public Builder unsetParentCallId() { - parentCallId = null; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for direction. - * @param direction String value for direction. - * @return Builder - */ - public Builder direction(String direction) { - this.direction = direction; - return this; - } - - /** - * Setter for state. - * @param state String value for state. - * @return Builder - */ - public Builder state(String state) { - this.state = state; - return this; - } - - /** - * Setter for identity. - * @param identity String value for identity. - * @return Builder - */ - public Builder identity(String identity) { - this.identity = OptionalNullable.of(identity); - return this; - } - - /** - * UnSetter for identity. - * @return Builder - */ - public Builder unsetIdentity() { - identity = null; - return this; - } - - /** - * Setter for stirShaken. - * @param stirShaken Map of String, value for stirShaken. - * @return Builder - */ - public Builder stirShaken(Map stirShaken) { - this.stirShaken = stirShaken; - return this; - } - - /** - * Setter for startTime. - * @param startTime LocalDateTime value for startTime. - * @return Builder - */ - public Builder startTime(LocalDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * Setter for enqueuedTime. - * @param enqueuedTime LocalDateTime value for enqueuedTime. - * @return Builder - */ - public Builder enqueuedTime(LocalDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; - return this; - } - - /** - * Setter for answerTime. - * @param answerTime LocalDateTime value for answerTime. - * @return Builder - */ - public Builder answerTime(LocalDateTime answerTime) { - this.answerTime = OptionalNullable.of(answerTime); - return this; - } - - /** - * UnSetter for answerTime. - * @return Builder - */ - public Builder unsetAnswerTime() { - answerTime = null; - return this; - } - - /** - * Setter for endTime. - * @param endTime LocalDateTime value for endTime. - * @return Builder - */ - public Builder endTime(LocalDateTime endTime) { - this.endTime = OptionalNullable.of(endTime); - return this; - } - - /** - * UnSetter for endTime. - * @return Builder - */ - public Builder unsetEndTime() { - endTime = null; - return this; - } - - /** - * Setter for disconnectCause. - * @param disconnectCause String value for disconnectCause. - * @return Builder - */ - public Builder disconnectCause(String disconnectCause) { - this.disconnectCause = OptionalNullable.of(disconnectCause); - return this; - } - - /** - * UnSetter for disconnectCause. - * @return Builder - */ - public Builder unsetDisconnectCause() { - disconnectCause = null; - return this; - } - - /** - * Setter for errorMessage. - * @param errorMessage String value for errorMessage. - * @return Builder - */ - public Builder errorMessage(String errorMessage) { - this.errorMessage = OptionalNullable.of(errorMessage); - return this; - } - - /** - * UnSetter for errorMessage. - * @return Builder - */ - public Builder unsetErrorMessage() { - errorMessage = null; - return this; - } - - /** - * Setter for errorId. - * @param errorId String value for errorId. - * @return Builder - */ - public Builder errorId(String errorId) { - this.errorId = OptionalNullable.of(errorId); - return this; - } - - /** - * UnSetter for errorId. - * @return Builder - */ - public Builder unsetErrorId() { - errorId = null; - return this; - } - - /** - * Setter for lastUpdate. - * @param lastUpdate LocalDateTime value for lastUpdate. - * @return Builder - */ - public Builder lastUpdate(LocalDateTime lastUpdate) { - this.lastUpdate = lastUpdate; - return this; - } - - /** - * Builds a new {@link CallState} object using the set fields. - * @return {@link CallState} - */ - public CallState build() { - return new CallState(callId, parentCallId, applicationId, accountId, to, from, - direction, state, identity, stirShaken, startTime, enqueuedTime, answerTime, endTime, - disconnectCause, errorMessage, errorId, lastUpdate); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/CallbackMethodEnum.java b/src/main/java/com/bandwidth/voice/models/CallbackMethodEnum.java deleted file mode 100644 index b89643b8..00000000 --- a/src/main/java/com/bandwidth/voice/models/CallbackMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * CallbackMethodEnum to be used. - */ -public enum CallbackMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static CallbackMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of CallbackMethodEnum values to list of string values. - * @param toConvert The list of CallbackMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (CallbackMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/ConferenceCallback.java b/src/main/java/com/bandwidth/voice/models/ConferenceCallback.java deleted file mode 100644 index b38dcff9..00000000 --- a/src/main/java/com/bandwidth/voice/models/ConferenceCallback.java +++ /dev/null @@ -1,667 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ConferenceCallback type. - */ -public class ConferenceCallback { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String conferenceId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String name; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String eventType; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String eventTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String to; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String from; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String recordingId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer channels; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String startTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String endTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String duration; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String fileFormat; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mediaUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - - /** - * Default constructor. - */ - public ConferenceCallback() { - } - - /** - * Initialization constructor. - * @param conferenceId String value for conferenceId. - * @param name String value for name. - * @param eventType String value for eventType. - * @param eventTime String value for eventTime. - * @param tag String value for tag. - * @param callId String value for callId. - * @param to String value for to. - * @param from String value for from. - * @param accountId String value for accountId. - * @param recordingId String value for recordingId. - * @param channels Integer value for channels. - * @param startTime String value for startTime. - * @param endTime String value for endTime. - * @param duration String value for duration. - * @param fileFormat String value for fileFormat. - * @param mediaUrl String value for mediaUrl. - * @param status String value for status. - */ - public ConferenceCallback( - String conferenceId, - String name, - String eventType, - String eventTime, - String tag, - String callId, - String to, - String from, - String accountId, - String recordingId, - Integer channels, - String startTime, - String endTime, - String duration, - String fileFormat, - String mediaUrl, - String status) { - this.conferenceId = conferenceId; - this.name = name; - this.eventType = eventType; - this.eventTime = eventTime; - this.tag = tag; - this.callId = callId; - this.to = to; - this.from = from; - this.accountId = accountId; - this.recordingId = recordingId; - this.channels = channels; - this.startTime = startTime; - this.endTime = endTime; - this.duration = duration; - this.fileFormat = fileFormat; - this.mediaUrl = mediaUrl; - this.status = status; - } - - /** - * Getter for ConferenceId. - * @return Returns the String - */ - @JsonGetter("conferenceId") - public String getConferenceId() { - return conferenceId; - } - - /** - * Setter for ConferenceId. - * @param conferenceId Value for String - */ - @JsonSetter("conferenceId") - public void setConferenceId(String conferenceId) { - this.conferenceId = conferenceId; - } - - /** - * Getter for Name. - * @return Returns the String - */ - @JsonGetter("name") - public String getName() { - return name; - } - - /** - * Setter for Name. - * @param name Value for String - */ - @JsonSetter("name") - public void setName(String name) { - this.name = name; - } - - /** - * Getter for EventType. - * @return Returns the String - */ - @JsonGetter("eventType") - public String getEventType() { - return eventType; - } - - /** - * Setter for EventType. - * @param eventType Value for String - */ - @JsonSetter("eventType") - public void setEventType(String eventType) { - this.eventType = eventType; - } - - /** - * Getter for EventTime. - * @return Returns the String - */ - @JsonGetter("eventTime") - public String getEventTime() { - return eventTime; - } - - /** - * Setter for EventTime. - * @param eventTime Value for String - */ - @JsonSetter("eventTime") - public void setEventTime(String eventTime) { - this.eventTime = eventTime; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for From. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for RecordingId. - * @return Returns the String - */ - @JsonGetter("recordingId") - public String getRecordingId() { - return recordingId; - } - - /** - * Setter for RecordingId. - * @param recordingId Value for String - */ - @JsonSetter("recordingId") - public void setRecordingId(String recordingId) { - this.recordingId = recordingId; - } - - /** - * Getter for Channels. - * @return Returns the Integer - */ - @JsonGetter("channels") - public Integer getChannels() { - return channels; - } - - /** - * Setter for Channels. - * @param channels Value for Integer - */ - @JsonSetter("channels") - public void setChannels(Integer channels) { - this.channels = channels; - } - - /** - * Getter for StartTime. - * @return Returns the String - */ - @JsonGetter("startTime") - public String getStartTime() { - return startTime; - } - - /** - * Setter for StartTime. - * @param startTime Value for String - */ - @JsonSetter("startTime") - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - /** - * Getter for EndTime. - * @return Returns the String - */ - @JsonGetter("endTime") - public String getEndTime() { - return endTime; - } - - /** - * Setter for EndTime. - * @param endTime Value for String - */ - @JsonSetter("endTime") - public void setEndTime(String endTime) { - this.endTime = endTime; - } - - /** - * Getter for Duration. - * @return Returns the String - */ - @JsonGetter("duration") - public String getDuration() { - return duration; - } - - /** - * Setter for Duration. - * @param duration Value for String - */ - @JsonSetter("duration") - public void setDuration(String duration) { - this.duration = duration; - } - - /** - * Getter for FileFormat. - * @return Returns the String - */ - @JsonGetter("fileFormat") - public String getFileFormat() { - return fileFormat; - } - - /** - * Setter for FileFormat. - * @param fileFormat Value for String - */ - @JsonSetter("fileFormat") - public void setFileFormat(String fileFormat) { - this.fileFormat = fileFormat; - } - - /** - * Getter for MediaUrl. - * @return Returns the String - */ - @JsonGetter("mediaUrl") - public String getMediaUrl() { - return mediaUrl; - } - - /** - * Setter for MediaUrl. - * @param mediaUrl Value for String - */ - @JsonSetter("mediaUrl") - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - /** - * Getter for Status. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Converts this ConferenceCallback into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ConferenceCallback [" + "conferenceId=" + conferenceId + ", name=" + name - + ", eventType=" + eventType + ", eventTime=" + eventTime + ", tag=" + tag - + ", callId=" + callId + ", to=" + to + ", from=" + from + ", accountId=" - + accountId + ", recordingId=" + recordingId + ", channels=" + channels - + ", startTime=" + startTime + ", endTime=" + endTime + ", duration=" + duration - + ", fileFormat=" + fileFormat + ", mediaUrl=" + mediaUrl + ", status=" + status - + "]"; - } - - /** - * Builds a new {@link ConferenceCallback.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ConferenceCallback.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .conferenceId(getConferenceId()) - .name(getName()) - .eventType(getEventType()) - .eventTime(getEventTime()) - .tag(getTag()) - .callId(getCallId()) - .to(getTo()) - .from(getFrom()) - .accountId(getAccountId()) - .recordingId(getRecordingId()) - .channels(getChannels()) - .startTime(getStartTime()) - .endTime(getEndTime()) - .duration(getDuration()) - .fileFormat(getFileFormat()) - .mediaUrl(getMediaUrl()) - .status(getStatus()); - return builder; - } - - /** - * Class to build instances of {@link ConferenceCallback}. - */ - public static class Builder { - private String conferenceId; - private String name; - private String eventType; - private String eventTime; - private String tag; - private String callId; - private String to; - private String from; - private String accountId; - private String recordingId; - private Integer channels; - private String startTime; - private String endTime; - private String duration; - private String fileFormat; - private String mediaUrl; - private String status; - - - - /** - * Setter for conferenceId. - * @param conferenceId String value for conferenceId. - * @return Builder - */ - public Builder conferenceId(String conferenceId) { - this.conferenceId = conferenceId; - return this; - } - - /** - * Setter for name. - * @param name String value for name. - * @return Builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Setter for eventType. - * @param eventType String value for eventType. - * @return Builder - */ - public Builder eventType(String eventType) { - this.eventType = eventType; - return this; - } - - /** - * Setter for eventTime. - * @param eventTime String value for eventTime. - * @return Builder - */ - public Builder eventTime(String eventTime) { - this.eventTime = eventTime; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for recordingId. - * @param recordingId String value for recordingId. - * @return Builder - */ - public Builder recordingId(String recordingId) { - this.recordingId = recordingId; - return this; - } - - /** - * Setter for channels. - * @param channels Integer value for channels. - * @return Builder - */ - public Builder channels(Integer channels) { - this.channels = channels; - return this; - } - - /** - * Setter for startTime. - * @param startTime String value for startTime. - * @return Builder - */ - public Builder startTime(String startTime) { - this.startTime = startTime; - return this; - } - - /** - * Setter for endTime. - * @param endTime String value for endTime. - * @return Builder - */ - public Builder endTime(String endTime) { - this.endTime = endTime; - return this; - } - - /** - * Setter for duration. - * @param duration String value for duration. - * @return Builder - */ - public Builder duration(String duration) { - this.duration = duration; - return this; - } - - /** - * Setter for fileFormat. - * @param fileFormat String value for fileFormat. - * @return Builder - */ - public Builder fileFormat(String fileFormat) { - this.fileFormat = fileFormat; - return this; - } - - /** - * Setter for mediaUrl. - * @param mediaUrl String value for mediaUrl. - * @return Builder - */ - public Builder mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Builds a new {@link ConferenceCallback} object using the set fields. - * @return {@link ConferenceCallback} - */ - public ConferenceCallback build() { - return new ConferenceCallback(conferenceId, name, eventType, eventTime, tag, callId, to, - from, accountId, recordingId, channels, startTime, endTime, duration, - fileFormat, mediaUrl, status); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ConferenceEventMethodEnum.java b/src/main/java/com/bandwidth/voice/models/ConferenceEventMethodEnum.java deleted file mode 100644 index 1d16084a..00000000 --- a/src/main/java/com/bandwidth/voice/models/ConferenceEventMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * ConferenceEventMethodEnum to be used. - */ -public enum ConferenceEventMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static ConferenceEventMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of ConferenceEventMethodEnum values to list of string values. - * @param toConvert The list of ConferenceEventMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (ConferenceEventMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/ConferenceMemberState.java b/src/main/java/com/bandwidth/voice/models/ConferenceMemberState.java deleted file mode 100644 index 840e6c34..00000000 --- a/src/main/java/com/bandwidth/voice/models/ConferenceMemberState.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.util.List; - -/** - * This is a model class for ConferenceMemberState type. - */ -public class ConferenceMemberState { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String conferenceId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String memberUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Boolean mute; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Boolean hold; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable> callIdsToCoach; - - /** - * Default constructor. - */ - public ConferenceMemberState() { - } - - /** - * Initialization constructor. - * @param callId String value for callId. - * @param conferenceId String value for conferenceId. - * @param memberUrl String value for memberUrl. - * @param mute Boolean value for mute. - * @param hold Boolean value for hold. - * @param callIdsToCoach List of String value for callIdsToCoach. - */ - public ConferenceMemberState( - String callId, - String conferenceId, - String memberUrl, - Boolean mute, - Boolean hold, - List callIdsToCoach) { - this.callId = callId; - this.conferenceId = conferenceId; - this.memberUrl = memberUrl; - this.mute = mute; - this.hold = hold; - this.callIdsToCoach = OptionalNullable.of(callIdsToCoach); - } - - /** - * Internal initialization constructor. - */ - protected ConferenceMemberState(String callId, String conferenceId, String memberUrl, - Boolean mute, Boolean hold, OptionalNullable> callIdsToCoach) { - this.callId = callId; - this.conferenceId = conferenceId; - this.memberUrl = memberUrl; - this.mute = mute; - this.hold = hold; - this.callIdsToCoach = callIdsToCoach; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Getter for ConferenceId. - * @return Returns the String - */ - @JsonGetter("conferenceId") - public String getConferenceId() { - return conferenceId; - } - - /** - * Setter for ConferenceId. - * @param conferenceId Value for String - */ - @JsonSetter("conferenceId") - public void setConferenceId(String conferenceId) { - this.conferenceId = conferenceId; - } - - /** - * Getter for MemberUrl. - * @return Returns the String - */ - @JsonGetter("memberUrl") - public String getMemberUrl() { - return memberUrl; - } - - /** - * Setter for MemberUrl. - * @param memberUrl Value for String - */ - @JsonSetter("memberUrl") - public void setMemberUrl(String memberUrl) { - this.memberUrl = memberUrl; - } - - /** - * Getter for Mute. - * @return Returns the Boolean - */ - @JsonGetter("mute") - public Boolean getMute() { - return mute; - } - - /** - * Setter for Mute. - * @param mute Value for Boolean - */ - @JsonSetter("mute") - public void setMute(Boolean mute) { - this.mute = mute; - } - - /** - * Getter for Hold. - * @return Returns the Boolean - */ - @JsonGetter("hold") - public Boolean getHold() { - return hold; - } - - /** - * Setter for Hold. - * @param hold Value for Boolean - */ - @JsonSetter("hold") - public void setHold(Boolean hold) { - this.hold = hold; - } - - /** - * Internal Getter for CallIdsToCoach. - * @return Returns the Internal List of String - */ - @JsonGetter("callIdsToCoach") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable> internalGetCallIdsToCoach() { - return this.callIdsToCoach; - } - - /** - * Getter for CallIdsToCoach. - * @return Returns the List of String - */ - public List getCallIdsToCoach() { - return OptionalNullable.getFrom(callIdsToCoach); - } - - /** - * Setter for CallIdsToCoach. - * @param callIdsToCoach Value for List of String - */ - @JsonSetter("callIdsToCoach") - public void setCallIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = OptionalNullable.of(callIdsToCoach); - } - - /** - * UnSetter for CallIdsToCoach. - */ - public void unsetCallIdsToCoach() { - callIdsToCoach = null; - } - - /** - * Converts this ConferenceMemberState into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ConferenceMemberState [" + "callId=" + callId + ", conferenceId=" + conferenceId - + ", memberUrl=" + memberUrl + ", mute=" + mute + ", hold=" + hold - + ", callIdsToCoach=" + callIdsToCoach + "]"; - } - - /** - * Builds a new {@link ConferenceMemberState.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ConferenceMemberState.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .callId(getCallId()) - .conferenceId(getConferenceId()) - .memberUrl(getMemberUrl()) - .mute(getMute()) - .hold(getHold()); - builder.callIdsToCoach = internalGetCallIdsToCoach(); - return builder; - } - - /** - * Class to build instances of {@link ConferenceMemberState}. - */ - public static class Builder { - private String callId; - private String conferenceId; - private String memberUrl; - private Boolean mute; - private Boolean hold; - private OptionalNullable> callIdsToCoach; - - - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for conferenceId. - * @param conferenceId String value for conferenceId. - * @return Builder - */ - public Builder conferenceId(String conferenceId) { - this.conferenceId = conferenceId; - return this; - } - - /** - * Setter for memberUrl. - * @param memberUrl String value for memberUrl. - * @return Builder - */ - public Builder memberUrl(String memberUrl) { - this.memberUrl = memberUrl; - return this; - } - - /** - * Setter for mute. - * @param mute Boolean value for mute. - * @return Builder - */ - public Builder mute(Boolean mute) { - this.mute = mute; - return this; - } - - /** - * Setter for hold. - * @param hold Boolean value for hold. - * @return Builder - */ - public Builder hold(Boolean hold) { - this.hold = hold; - return this; - } - - /** - * Setter for callIdsToCoach. - * @param callIdsToCoach List of String value for callIdsToCoach. - * @return Builder - */ - public Builder callIdsToCoach(List callIdsToCoach) { - this.callIdsToCoach = OptionalNullable.of(callIdsToCoach); - return this; - } - - /** - * UnSetter for callIdsToCoach. - * @return Builder - */ - public Builder unsetCallIdsToCoach() { - callIdsToCoach = null; - return this; - } - - /** - * Builds a new {@link ConferenceMemberState} object using the set fields. - * @return {@link ConferenceMemberState} - */ - public ConferenceMemberState build() { - return new ConferenceMemberState(callId, conferenceId, memberUrl, mute, hold, - callIdsToCoach); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ConferenceRecordingMetadata.java b/src/main/java/com/bandwidth/voice/models/ConferenceRecordingMetadata.java deleted file mode 100644 index 2fa3df56..00000000 --- a/src/main/java/com/bandwidth/voice/models/ConferenceRecordingMetadata.java +++ /dev/null @@ -1,470 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.DateTimeHelper; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.LocalDateTime; - -/** - * This is a model class for ConferenceRecordingMetadata type. - */ -public class ConferenceRecordingMetadata { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String accountId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String conferenceId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String name; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String recordingId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String duration; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer channels; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime startTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime endTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private FileFormatEnum fileFormat; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String mediaUrl; - - /** - * Default constructor. - */ - public ConferenceRecordingMetadata() { - } - - /** - * Initialization constructor. - * @param accountId String value for accountId. - * @param conferenceId String value for conferenceId. - * @param name String value for name. - * @param recordingId String value for recordingId. - * @param duration String value for duration. - * @param channels Integer value for channels. - * @param startTime LocalDateTime value for startTime. - * @param endTime LocalDateTime value for endTime. - * @param fileFormat FileFormatEnum value for fileFormat. - * @param status String value for status. - * @param mediaUrl String value for mediaUrl. - */ - public ConferenceRecordingMetadata( - String accountId, - String conferenceId, - String name, - String recordingId, - String duration, - Integer channels, - LocalDateTime startTime, - LocalDateTime endTime, - FileFormatEnum fileFormat, - String status, - String mediaUrl) { - this.accountId = accountId; - this.conferenceId = conferenceId; - this.name = name; - this.recordingId = recordingId; - this.duration = duration; - this.channels = channels; - this.startTime = startTime; - this.endTime = endTime; - this.fileFormat = fileFormat; - this.status = status; - this.mediaUrl = mediaUrl; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for ConferenceId. - * @return Returns the String - */ - @JsonGetter("conferenceId") - public String getConferenceId() { - return conferenceId; - } - - /** - * Setter for ConferenceId. - * @param conferenceId Value for String - */ - @JsonSetter("conferenceId") - public void setConferenceId(String conferenceId) { - this.conferenceId = conferenceId; - } - - /** - * Getter for Name. - * @return Returns the String - */ - @JsonGetter("name") - public String getName() { - return name; - } - - /** - * Setter for Name. - * @param name Value for String - */ - @JsonSetter("name") - public void setName(String name) { - this.name = name; - } - - /** - * Getter for RecordingId. - * @return Returns the String - */ - @JsonGetter("recordingId") - public String getRecordingId() { - return recordingId; - } - - /** - * Setter for RecordingId. - * @param recordingId Value for String - */ - @JsonSetter("recordingId") - public void setRecordingId(String recordingId) { - this.recordingId = recordingId; - } - - /** - * Getter for Duration. - * Format is ISO-8601 - * @return Returns the String - */ - @JsonGetter("duration") - public String getDuration() { - return duration; - } - - /** - * Setter for Duration. - * Format is ISO-8601 - * @param duration Value for String - */ - @JsonSetter("duration") - public void setDuration(String duration) { - this.duration = duration; - } - - /** - * Getter for Channels. - * @return Returns the Integer - */ - @JsonGetter("channels") - public Integer getChannels() { - return channels; - } - - /** - * Setter for Channels. - * @param channels Value for Integer - */ - @JsonSetter("channels") - public void setChannels(Integer channels) { - this.channels = channels; - } - - /** - * Getter for StartTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("startTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getStartTime() { - return startTime; - } - - /** - * Setter for StartTime. - * @param startTime Value for LocalDateTime - */ - @JsonSetter("startTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setStartTime(LocalDateTime startTime) { - this.startTime = startTime; - } - - /** - * Getter for EndTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("endTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getEndTime() { - return endTime; - } - - /** - * Setter for EndTime. - * @param endTime Value for LocalDateTime - */ - @JsonSetter("endTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setEndTime(LocalDateTime endTime) { - this.endTime = endTime; - } - - /** - * Getter for FileFormat. - * @return Returns the FileFormatEnum - */ - @JsonGetter("fileFormat") - public FileFormatEnum getFileFormat() { - return fileFormat; - } - - /** - * Setter for FileFormat. - * @param fileFormat Value for FileFormatEnum - */ - @JsonSetter("fileFormat") - public void setFileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; - } - - /** - * Getter for Status. - * The current status of the recording. Current possible values are 'processing', 'partial', - * 'complete', 'deleted', and 'error'. Additional states may be added in the future, so your - * application must be tolerant of unknown values. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * The current status of the recording. Current possible values are 'processing', 'partial', - * 'complete', 'deleted', and 'error'. Additional states may be added in the future, so your - * application must be tolerant of unknown values. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for MediaUrl. - * @return Returns the String - */ - @JsonGetter("mediaUrl") - public String getMediaUrl() { - return mediaUrl; - } - - /** - * Setter for MediaUrl. - * @param mediaUrl Value for String - */ - @JsonSetter("mediaUrl") - public void setMediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - } - - /** - * Converts this ConferenceRecordingMetadata into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ConferenceRecordingMetadata [" + "accountId=" + accountId + ", conferenceId=" - + conferenceId + ", name=" + name + ", recordingId=" + recordingId + ", duration=" - + duration + ", channels=" + channels + ", startTime=" + startTime + ", endTime=" - + endTime + ", fileFormat=" + fileFormat + ", status=" + status + ", mediaUrl=" - + mediaUrl + "]"; - } - - /** - * Builds a new {@link ConferenceRecordingMetadata.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ConferenceRecordingMetadata.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .accountId(getAccountId()) - .conferenceId(getConferenceId()) - .name(getName()) - .recordingId(getRecordingId()) - .duration(getDuration()) - .channels(getChannels()) - .startTime(getStartTime()) - .endTime(getEndTime()) - .fileFormat(getFileFormat()) - .status(getStatus()) - .mediaUrl(getMediaUrl()); - return builder; - } - - /** - * Class to build instances of {@link ConferenceRecordingMetadata}. - */ - public static class Builder { - private String accountId; - private String conferenceId; - private String name; - private String recordingId; - private String duration; - private Integer channels; - private LocalDateTime startTime; - private LocalDateTime endTime; - private FileFormatEnum fileFormat; - private String status; - private String mediaUrl; - - - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for conferenceId. - * @param conferenceId String value for conferenceId. - * @return Builder - */ - public Builder conferenceId(String conferenceId) { - this.conferenceId = conferenceId; - return this; - } - - /** - * Setter for name. - * @param name String value for name. - * @return Builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Setter for recordingId. - * @param recordingId String value for recordingId. - * @return Builder - */ - public Builder recordingId(String recordingId) { - this.recordingId = recordingId; - return this; - } - - /** - * Setter for duration. - * @param duration String value for duration. - * @return Builder - */ - public Builder duration(String duration) { - this.duration = duration; - return this; - } - - /** - * Setter for channels. - * @param channels Integer value for channels. - * @return Builder - */ - public Builder channels(Integer channels) { - this.channels = channels; - return this; - } - - /** - * Setter for startTime. - * @param startTime LocalDateTime value for startTime. - * @return Builder - */ - public Builder startTime(LocalDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * Setter for endTime. - * @param endTime LocalDateTime value for endTime. - * @return Builder - */ - public Builder endTime(LocalDateTime endTime) { - this.endTime = endTime; - return this; - } - - /** - * Setter for fileFormat. - * @param fileFormat FileFormatEnum value for fileFormat. - * @return Builder - */ - public Builder fileFormat(FileFormatEnum fileFormat) { - this.fileFormat = fileFormat; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for mediaUrl. - * @param mediaUrl String value for mediaUrl. - * @return Builder - */ - public Builder mediaUrl(String mediaUrl) { - this.mediaUrl = mediaUrl; - return this; - } - - /** - * Builds a new {@link ConferenceRecordingMetadata} object using the set fields. - * @return {@link ConferenceRecordingMetadata} - */ - public ConferenceRecordingMetadata build() { - return new ConferenceRecordingMetadata(accountId, conferenceId, name, recordingId, - duration, channels, startTime, endTime, fileFormat, status, mediaUrl); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ConferenceState.java b/src/main/java/com/bandwidth/voice/models/ConferenceState.java deleted file mode 100644 index 516311b0..00000000 --- a/src/main/java/com/bandwidth/voice/models/ConferenceState.java +++ /dev/null @@ -1,475 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.DateTimeHelper; -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.LocalDateTime; -import java.util.List; - -/** - * This is a model class for ConferenceState type. - */ -public class ConferenceState { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String name; - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime createdTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable completedTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable conferenceEventUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable conferenceEventMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List activeMembers; - - /** - * Default constructor. - */ - public ConferenceState() { - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param name String value for name. - * @param createdTime LocalDateTime value for createdTime. - * @param completedTime LocalDateTime value for completedTime. - * @param conferenceEventUrl String value for conferenceEventUrl. - * @param conferenceEventMethod ConferenceEventMethodEnum value for conferenceEventMethod. - * @param tag String value for tag. - * @param activeMembers List of ConferenceMemberState value for activeMembers. - */ - public ConferenceState( - String id, - String name, - LocalDateTime createdTime, - LocalDateTime completedTime, - String conferenceEventUrl, - ConferenceEventMethodEnum conferenceEventMethod, - String tag, - List activeMembers) { - this.id = id; - this.name = name; - this.createdTime = createdTime; - this.completedTime = OptionalNullable.of(completedTime); - this.conferenceEventUrl = OptionalNullable.of(conferenceEventUrl); - this.conferenceEventMethod = OptionalNullable.of(conferenceEventMethod); - this.tag = OptionalNullable.of(tag); - this.activeMembers = activeMembers; - } - - /** - * Internal initialization constructor. - */ - protected ConferenceState(String id, String name, LocalDateTime createdTime, - OptionalNullable completedTime, - OptionalNullable conferenceEventUrl, - OptionalNullable conferenceEventMethod, - OptionalNullable tag, List activeMembers) { - this.id = id; - this.name = name; - this.createdTime = createdTime; - this.completedTime = completedTime; - this.conferenceEventUrl = conferenceEventUrl; - this.conferenceEventMethod = conferenceEventMethod; - this.tag = tag; - this.activeMembers = activeMembers; - } - - /** - * Getter for Id. - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Getter for Name. - * @return Returns the String - */ - @JsonGetter("name") - public String getName() { - return name; - } - - /** - * Setter for Name. - * @param name Value for String - */ - @JsonSetter("name") - public void setName(String name) { - this.name = name; - } - - /** - * Getter for CreatedTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("createdTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getCreatedTime() { - return createdTime; - } - - /** - * Setter for CreatedTime. - * @param createdTime Value for LocalDateTime - */ - @JsonSetter("createdTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setCreatedTime(LocalDateTime createdTime) { - this.createdTime = createdTime; - } - - /** - * Internal Getter for CompletedTime. - * @return Returns the Internal LocalDateTime - */ - @JsonGetter("completedTime") - @JsonSerialize(using = OptionalNullable.Rfc8601DateTimeSerializer.class) - protected OptionalNullable internalGetCompletedTime() { - return this.completedTime; - } - - /** - * Getter for CompletedTime. - * @return Returns the LocalDateTime - */ - public LocalDateTime getCompletedTime() { - return OptionalNullable.getFrom(completedTime); - } - - /** - * Setter for CompletedTime. - * @param completedTime Value for LocalDateTime - */ - @JsonSetter("completedTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setCompletedTime(LocalDateTime completedTime) { - this.completedTime = OptionalNullable.of(completedTime); - } - - /** - * UnSetter for CompletedTime. - */ - public void unsetCompletedTime() { - completedTime = null; - } - - /** - * Internal Getter for ConferenceEventUrl. - * @return Returns the Internal String - */ - @JsonGetter("conferenceEventUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetConferenceEventUrl() { - return this.conferenceEventUrl; - } - - /** - * Getter for ConferenceEventUrl. - * @return Returns the String - */ - public String getConferenceEventUrl() { - return OptionalNullable.getFrom(conferenceEventUrl); - } - - /** - * Setter for ConferenceEventUrl. - * @param conferenceEventUrl Value for String - */ - @JsonSetter("conferenceEventUrl") - public void setConferenceEventUrl(String conferenceEventUrl) { - this.conferenceEventUrl = OptionalNullable.of(conferenceEventUrl); - } - - /** - * UnSetter for ConferenceEventUrl. - */ - public void unsetConferenceEventUrl() { - conferenceEventUrl = null; - } - - /** - * Internal Getter for ConferenceEventMethod. - * @return Returns the Internal ConferenceEventMethodEnum - */ - @JsonGetter("conferenceEventMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetConferenceEventMethod() { - return this.conferenceEventMethod; - } - - /** - * Getter for ConferenceEventMethod. - * @return Returns the ConferenceEventMethodEnum - */ - public ConferenceEventMethodEnum getConferenceEventMethod() { - return OptionalNullable.getFrom(conferenceEventMethod); - } - - /** - * Setter for ConferenceEventMethod. - * @param conferenceEventMethod Value for ConferenceEventMethodEnum - */ - @JsonSetter("conferenceEventMethod") - public void setConferenceEventMethod(ConferenceEventMethodEnum conferenceEventMethod) { - this.conferenceEventMethod = OptionalNullable.of(conferenceEventMethod); - } - - /** - * UnSetter for ConferenceEventMethod. - */ - public void unsetConferenceEventMethod() { - conferenceEventMethod = null; - } - - /** - * Internal Getter for Tag. - * @return Returns the Internal String - */ - @JsonGetter("tag") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetTag() { - return this.tag; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - public String getTag() { - return OptionalNullable.getFrom(tag); - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = OptionalNullable.of(tag); - } - - /** - * UnSetter for Tag. - */ - public void unsetTag() { - tag = null; - } - - /** - * Getter for ActiveMembers. - * @return Returns the List of ConferenceMemberState - */ - @JsonGetter("activeMembers") - public List getActiveMembers() { - return activeMembers; - } - - /** - * Setter for ActiveMembers. - * @param activeMembers Value for List of ConferenceMemberState - */ - @JsonSetter("activeMembers") - public void setActiveMembers(List activeMembers) { - this.activeMembers = activeMembers; - } - - /** - * Converts this ConferenceState into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ConferenceState [" + "id=" + id + ", name=" + name + ", createdTime=" + createdTime - + ", completedTime=" + completedTime + ", conferenceEventUrl=" + conferenceEventUrl - + ", conferenceEventMethod=" + conferenceEventMethod + ", tag=" + tag - + ", activeMembers=" + activeMembers + "]"; - } - - /** - * Builds a new {@link ConferenceState.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ConferenceState.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .name(getName()) - .createdTime(getCreatedTime()) - .activeMembers(getActiveMembers()); - builder.completedTime = internalGetCompletedTime(); - builder.conferenceEventUrl = internalGetConferenceEventUrl(); - builder.conferenceEventMethod = internalGetConferenceEventMethod(); - builder.tag = internalGetTag(); - return builder; - } - - /** - * Class to build instances of {@link ConferenceState}. - */ - public static class Builder { - private String id; - private String name; - private LocalDateTime createdTime; - private OptionalNullable completedTime; - private OptionalNullable conferenceEventUrl; - private OptionalNullable conferenceEventMethod; - private OptionalNullable tag; - private List activeMembers; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for name. - * @param name String value for name. - * @return Builder - */ - public Builder name(String name) { - this.name = name; - return this; - } - - /** - * Setter for createdTime. - * @param createdTime LocalDateTime value for createdTime. - * @return Builder - */ - public Builder createdTime(LocalDateTime createdTime) { - this.createdTime = createdTime; - return this; - } - - /** - * Setter for completedTime. - * @param completedTime LocalDateTime value for completedTime. - * @return Builder - */ - public Builder completedTime(LocalDateTime completedTime) { - this.completedTime = OptionalNullable.of(completedTime); - return this; - } - - /** - * UnSetter for completedTime. - * @return Builder - */ - public Builder unsetCompletedTime() { - completedTime = null; - return this; - } - - /** - * Setter for conferenceEventUrl. - * @param conferenceEventUrl String value for conferenceEventUrl. - * @return Builder - */ - public Builder conferenceEventUrl(String conferenceEventUrl) { - this.conferenceEventUrl = OptionalNullable.of(conferenceEventUrl); - return this; - } - - /** - * UnSetter for conferenceEventUrl. - * @return Builder - */ - public Builder unsetConferenceEventUrl() { - conferenceEventUrl = null; - return this; - } - - /** - * Setter for conferenceEventMethod. - * @param conferenceEventMethod ConferenceEventMethodEnum value for conferenceEventMethod. - * @return Builder - */ - public Builder conferenceEventMethod(ConferenceEventMethodEnum conferenceEventMethod) { - this.conferenceEventMethod = OptionalNullable.of(conferenceEventMethod); - return this; - } - - /** - * UnSetter for conferenceEventMethod. - * @return Builder - */ - public Builder unsetConferenceEventMethod() { - conferenceEventMethod = null; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = OptionalNullable.of(tag); - return this; - } - - /** - * UnSetter for tag. - * @return Builder - */ - public Builder unsetTag() { - tag = null; - return this; - } - - /** - * Setter for activeMembers. - * @param activeMembers List of ConferenceMemberState value for activeMembers. - * @return Builder - */ - public Builder activeMembers(List activeMembers) { - this.activeMembers = activeMembers; - return this; - } - - /** - * Builds a new {@link ConferenceState} object using the set fields. - * @return {@link ConferenceState} - */ - public ConferenceState build() { - return new ConferenceState(id, name, createdTime, completedTime, conferenceEventUrl, - conferenceEventMethod, tag, activeMembers); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/CreateCallRequest.java b/src/main/java/com/bandwidth/voice/models/CreateCallRequest.java deleted file mode 100644 index 42baf1d8..00000000 --- a/src/main/java/com/bandwidth/voice/models/CreateCallRequest.java +++ /dev/null @@ -1,1162 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * This is a model class for CreateCallRequest type. - */ -public class CreateCallRequest { - private String from; - private String to; - private String answerUrl; - private String applicationId; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable uui; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callTimeout; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackTimeout; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerFallbackUrl; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUsername; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackPassword; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerMethod; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerFallbackMethod; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable disconnectUrl; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable disconnectMethod; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable tag; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private MachineDetectionConfiguration machineDetection; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer priority; - - /** - * Default constructor. - */ - public CreateCallRequest() { - } - - /** - * Initialization constructor. - * @param from String value for from. - * @param to String value for to. - * @param answerUrl String value for answerUrl. - * @param applicationId String value for applicationId. - * @param uui String value for uui. - * @param callTimeout Double value for callTimeout. - * @param callbackTimeout Double value for callbackTimeout. - * @param answerFallbackUrl String value for answerFallbackUrl. - * @param username String value for username. - * @param password String value for password. - * @param fallbackUsername String value for fallbackUsername. - * @param fallbackPassword String value for fallbackPassword. - * @param answerMethod AnswerMethodEnum value for answerMethod. - * @param answerFallbackMethod AnswerFallbackMethodEnum value for answerFallbackMethod. - * @param disconnectUrl String value for disconnectUrl. - * @param disconnectMethod DisconnectMethodEnum value for disconnectMethod. - * @param tag String value for tag. - * @param machineDetection MachineDetectionConfiguration value for machineDetection. - * @param priority Integer value for priority - */ - public CreateCallRequest( - String from, - String to, - String answerUrl, - String applicationId, - String uui, - Double callTimeout, - Double callbackTimeout, - String answerFallbackUrl, - String username, - String password, - String fallbackUsername, - String fallbackPassword, - AnswerMethodEnum answerMethod, - AnswerFallbackMethodEnum answerFallbackMethod, - String disconnectUrl, - DisconnectMethodEnum disconnectMethod, - String tag, - MachineDetectionConfiguration machineDetection, - Integer priority) { - this.from = from; - this.to = to; - this.uui = OptionalNullable.of(uui); - this.callTimeout = OptionalNullable.of(callTimeout); - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - this.answerUrl = answerUrl; - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - this.answerMethod = OptionalNullable.of(answerMethod); - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - this.disconnectMethod = OptionalNullable.of(disconnectMethod); - this.tag = OptionalNullable.of(tag); - this.applicationId = applicationId; - this.machineDetection = machineDetection; - this.priority = priority; - } - - /** - * Internal initialization constructor. - */ - protected CreateCallRequest(String from, String to, String answerUrl, String applicationId, - OptionalNullable uui, OptionalNullable callTimeout, - OptionalNullable callbackTimeout, OptionalNullable answerFallbackUrl, - OptionalNullable username, OptionalNullable password, - OptionalNullable fallbackUsername, OptionalNullable fallbackPassword, - OptionalNullable answerMethod, - OptionalNullable answerFallbackMethod, - OptionalNullable disconnectUrl, - OptionalNullable disconnectMethod, OptionalNullable tag, - MachineDetectionConfiguration machineDetection, Integer priority) { - this.from = from; - this.to = to; - this.uui = uui; - this.callTimeout = callTimeout; - this.callbackTimeout = callbackTimeout; - this.answerUrl = answerUrl; - this.answerFallbackUrl = answerFallbackUrl; - this.username = username; - this.password = password; - this.fallbackUsername = fallbackUsername; - this.fallbackPassword = fallbackPassword; - this.answerMethod = answerMethod; - this.answerFallbackMethod = answerFallbackMethod; - this.disconnectUrl = disconnectUrl; - this.disconnectMethod = disconnectMethod; - this.tag = tag; - this.applicationId = applicationId; - this.machineDetection = machineDetection; - this.priority = priority; - } - - /** - * Getter for From. - * Format is E164 - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * Format is E164 - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for To. - * Format is E164 or SIP URI - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * Format is E164 or SIP URI - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Internal Getter for Uui. - * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP - * URI. Each value must end with an 'encoding' parameter as described in - * https://tools.ietf.org/html/rfc7433. Only 'jwt' and 'base64' encodings are allowed. The - * entire value cannot exceed 350 characters, including parameters and separators. - * @return Returns the Internal String - */ - @JsonGetter("uui") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUui() { - return this.uui; - } - - /** - * Getter for Uui. - * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP - * URI. Each value must end with an 'encoding' parameter as described in - * https://tools.ietf.org/html/rfc7433. Only 'jwt' and 'base64' encodings are allowed. The - * entire value cannot exceed 350 characters, including parameters and separators. - * @return Returns the String - */ - public String getUui() { - return OptionalNullable.getFrom(uui); - } - - /** - * Setter for Uui. - * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP - * URI. Each value must end with an 'encoding' parameter as described in - * https://tools.ietf.org/html/rfc7433. Only 'jwt' and 'base64' encodings are allowed. The - * entire value cannot exceed 350 characters, including parameters and separators. - * @param uui Value for String - */ - @JsonSetter("uui") - public void setUui(String uui) { - this.uui = OptionalNullable.of(uui); - } - - /** - * UnSetter for Uui. - * A comma-separated list of 'User-To-User' headers to be sent in the INVITE when calling a SIP - * URI. Each value must end with an 'encoding' parameter as described in - * https://tools.ietf.org/html/rfc7433. Only 'jwt' and 'base64' encodings are allowed. The - * entire value cannot exceed 350 characters, including parameters and separators. - */ - public void unsetUui() { - uui = null; - } - - /** - * Internal Getter for CallTimeout. - * @return Returns the Internal Double - */ - @JsonGetter("callTimeout") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallTimeout() { - return this.callTimeout; - } - - /** - * Getter for CallTimeout. - * @return Returns the Double - */ - public Double getCallTimeout() { - return OptionalNullable.getFrom(callTimeout); - } - - /** - * Setter for CallTimeout. - * @param callTimeout Value for Double - */ - @JsonSetter("callTimeout") - public void setCallTimeout(Double callTimeout) { - this.callTimeout = OptionalNullable.of(callTimeout); - } - - /** - * UnSetter for CallTimeout. - */ - public void unsetCallTimeout() { - callTimeout = null; - } - - /** - * Internal Getter for CallbackTimeout. - * @return Returns the Internal Double - */ - @JsonGetter("callbackTimeout") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackTimeout() { - return this.callbackTimeout; - } - - /** - * Getter for CallbackTimeout. - * @return Returns the Double - */ - public Double getCallbackTimeout() { - return OptionalNullable.getFrom(callbackTimeout); - } - - /** - * Setter for CallbackTimeout. - * @param callbackTimeout Value for Double - */ - @JsonSetter("callbackTimeout") - public void setCallbackTimeout(Double callbackTimeout) { - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - } - - /** - * UnSetter for CallbackTimeout. - */ - public void unsetCallbackTimeout() { - callbackTimeout = null; - } - - /** - * Getter for AnswerUrl. - * @return Returns the String - */ - @JsonGetter("answerUrl") - public String getAnswerUrl() { - return answerUrl; - } - - /** - * Setter for AnswerUrl. - * @param answerUrl Value for String - */ - @JsonSetter("answerUrl") - public void setAnswerUrl(String answerUrl) { - this.answerUrl = answerUrl; - } - - /** - * Internal Getter for AnswerFallbackUrl. - * @return Returns the Internal String - */ - @JsonGetter("answerFallbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetAnswerFallbackUrl() { - return this.answerFallbackUrl; - } - - /** - * Getter for AnswerFallbackUrl. - * @return Returns the String - */ - public String getAnswerFallbackUrl() { - return OptionalNullable.getFrom(answerFallbackUrl); - } - - /** - * Setter for AnswerFallbackUrl. - * @param answerFallbackUrl Value for String - */ - @JsonSetter("answerFallbackUrl") - public void setAnswerFallbackUrl(String answerFallbackUrl) { - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - } - - /** - * UnSetter for AnswerFallbackUrl. - */ - public void unsetAnswerFallbackUrl() { - answerFallbackUrl = null; - } - - /** - * Internal Getter for Username. - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for FallbackUsername. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUsername") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUsername() { - return this.fallbackUsername; - } - - /** - * Getter for FallbackUsername. - * @return Returns the String - */ - public String getFallbackUsername() { - return OptionalNullable.getFrom(fallbackUsername); - } - - /** - * Setter for FallbackUsername. - * @param fallbackUsername Value for String - */ - @JsonSetter("fallbackUsername") - public void setFallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - } - - /** - * UnSetter for FallbackUsername. - */ - public void unsetFallbackUsername() { - fallbackUsername = null; - } - - /** - * Internal Getter for FallbackPassword. - * @return Returns the Internal String - */ - @JsonGetter("fallbackPassword") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackPassword() { - return this.fallbackPassword; - } - - /** - * Getter for FallbackPassword. - * @return Returns the String - */ - public String getFallbackPassword() { - return OptionalNullable.getFrom(fallbackPassword); - } - - /** - * Setter for FallbackPassword. - * @param fallbackPassword Value for String - */ - @JsonSetter("fallbackPassword") - public void setFallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * UnSetter for FallbackPassword. - */ - public void unsetFallbackPassword() { - fallbackPassword = null; - } - - /** - * Internal Getter for AnswerMethod. - * @return Returns the Internal AnswerMethodEnum - */ - @JsonGetter("answerMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetAnswerMethod() { - return this.answerMethod; - } - - /** - * Getter for AnswerMethod. - * @return Returns the AnswerMethodEnum - */ - public AnswerMethodEnum getAnswerMethod() { - return OptionalNullable.getFrom(answerMethod); - } - - /** - * Setter for AnswerMethod. - * @param answerMethod Value for AnswerMethodEnum - */ - @JsonSetter("answerMethod") - public void setAnswerMethod(AnswerMethodEnum answerMethod) { - this.answerMethod = OptionalNullable.of(answerMethod); - } - - /** - * UnSetter for AnswerMethod. - */ - public void unsetAnswerMethod() { - answerMethod = null; - } - - /** - * Internal Getter for AnswerFallbackMethod. - * @return Returns the Internal AnswerFallbackMethodEnum - */ - @JsonGetter("answerFallbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetAnswerFallbackMethod() { - return this.answerFallbackMethod; - } - - /** - * Getter for AnswerFallbackMethod. - * @return Returns the AnswerFallbackMethodEnum - */ - public AnswerFallbackMethodEnum getAnswerFallbackMethod() { - return OptionalNullable.getFrom(answerFallbackMethod); - } - - /** - * Setter for AnswerFallbackMethod. - * @param answerFallbackMethod Value for AnswerFallbackMethodEnum - */ - @JsonSetter("answerFallbackMethod") - public void setAnswerFallbackMethod(AnswerFallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - } - - /** - * UnSetter for AnswerFallbackMethod. - */ - public void unsetAnswerFallbackMethod() { - answerFallbackMethod = null; - } - - /** - * Internal Getter for DisconnectUrl. - * @return Returns the Internal String - */ - @JsonGetter("disconnectUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetDisconnectUrl() { - return this.disconnectUrl; - } - - /** - * Getter for DisconnectUrl. - * @return Returns the String - */ - public String getDisconnectUrl() { - return OptionalNullable.getFrom(disconnectUrl); - } - - /** - * Setter for DisconnectUrl. - * @param disconnectUrl Value for String - */ - @JsonSetter("disconnectUrl") - public void setDisconnectUrl(String disconnectUrl) { - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - } - - /** - * UnSetter for DisconnectUrl. - */ - public void unsetDisconnectUrl() { - disconnectUrl = null; - } - - /** - * Internal Getter for DisconnectMethod. - * @return Returns the Internal DisconnectMethodEnum - */ - @JsonGetter("disconnectMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetDisconnectMethod() { - return this.disconnectMethod; - } - - /** - * Getter for DisconnectMethod. - * @return Returns the DisconnectMethodEnum - */ - public DisconnectMethodEnum getDisconnectMethod() { - return OptionalNullable.getFrom(disconnectMethod); - } - - /** - * Setter for DisconnectMethod. - * @param disconnectMethod Value for DisconnectMethodEnum - */ - @JsonSetter("disconnectMethod") - public void setDisconnectMethod(DisconnectMethodEnum disconnectMethod) { - this.disconnectMethod = OptionalNullable.of(disconnectMethod); - } - - /** - * UnSetter for DisconnectMethod. - */ - public void unsetDisconnectMethod() { - disconnectMethod = null; - } - - /** - * Internal Getter for Tag. - * @return Returns the Internal String - */ - @JsonGetter("tag") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetTag() { - return this.tag; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - public String getTag() { - return OptionalNullable.getFrom(tag); - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = OptionalNullable.of(tag); - } - - /** - * UnSetter for Tag. - */ - public void unsetTag() { - tag = null; - } - - /** - * Getter for ApplicationId. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for MachineDetection. - * @return Returns the MachineDetectionConfiguration - */ - @JsonGetter("machineDetection") - public MachineDetectionConfiguration getMachineDetection() { - return machineDetection; - } - - /** - * Setter for MachineDetection. - * @param machineDetection Value for MachineDetectionRequest - */ - @JsonSetter("machineDetection") - public void setMachineDetection(MachineDetectionConfiguration machineDetection) { - this.machineDetection = machineDetection; - } - - /** - * Internal Getter for Priority. - * @return Returns the Internal Integer - */ - @JsonGetter("priority") - protected Integer internalGetPriority() { - return this.priority; - } - - /** - * Getter for Priority. - * @return Returns the Priority - */ - @JsonGetter("priority") - public Integer getPriority() { return this.priority; } - - /** - * Setter for Priority. - * @param priority Value for Integer - */ - @JsonSetter("priority") - public void setPriority(Integer priority) { - this.priority = priority; - } - - /** - * Converts this CreateCallRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "CreateCallRequest [" + "from=" + from + ", to=" + to + ", answerUrl=" + answerUrl - + ", applicationId=" + applicationId + ", uui=" + uui + ", callTimeout=" - + callTimeout + ", callbackTimeout=" + callbackTimeout + ", answerFallbackUrl=" - + answerFallbackUrl + ", username=" + username + ", password=" + password - + ", fallbackUsername=" + fallbackUsername + ", fallbackPassword=" - + fallbackPassword + ", answerMethod=" + answerMethod + ", answerFallbackMethod=" - + answerFallbackMethod + ", disconnectUrl=" + disconnectUrl + ", disconnectMethod=" - + disconnectMethod + ", tag=" + tag + ", machineDetection=" + machineDetection - + ", priority=" + priority + "]"; - } - - /** - * Builds a new {@link CreateCallRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link CreateCallRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(from, to, answerUrl, applicationId) - .machineDetection(getMachineDetection()); - builder.uui = internalGetUui(); - builder.callTimeout = internalGetCallTimeout(); - builder.callbackTimeout = internalGetCallbackTimeout(); - builder.answerFallbackUrl = internalGetAnswerFallbackUrl(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.fallbackUsername = internalGetFallbackUsername(); - builder.fallbackPassword = internalGetFallbackPassword(); - builder.answerMethod = internalGetAnswerMethod(); - builder.answerFallbackMethod = internalGetAnswerFallbackMethod(); - builder.disconnectUrl = internalGetDisconnectUrl(); - builder.disconnectMethod = internalGetDisconnectMethod(); - builder.tag = internalGetTag(); - builder.priority = internalGetPriority(); - return builder; - } - - /** - * Class to build instances of {@link CreateCallRequest}. - */ - public static class Builder { - private String from; - private String to; - private String answerUrl; - private String applicationId; - private OptionalNullable uui; - private OptionalNullable callTimeout; - private OptionalNullable callbackTimeout; - private OptionalNullable answerFallbackUrl; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable fallbackUsername; - private OptionalNullable fallbackPassword; - private OptionalNullable answerMethod; - private OptionalNullable answerFallbackMethod; - private OptionalNullable disconnectUrl; - private OptionalNullable disconnectMethod; - private OptionalNullable tag; - private MachineDetectionConfiguration machineDetection; - private Integer priority; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param from String value for from. - * @param to String value for to. - * @param answerUrl String value for answerUrl. - * @param applicationId String value for applicationId. - */ - public Builder(String from, String to, String answerUrl, String applicationId) { - this.from = from; - this.to = to; - this.answerUrl = answerUrl; - this.applicationId = applicationId; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for answerUrl. - * @param answerUrl String value for answerUrl. - * @return Builder - */ - public Builder answerUrl(String answerUrl) { - this.answerUrl = answerUrl; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for uui. - * @param uui String value for uui. - * @return Builder - */ - public Builder uui(String uui) { - this.uui = OptionalNullable.of(uui); - return this; - } - - /** - * UnSetter for uui. - * @return Builder - */ - public Builder unsetUui() { - uui = null; - return this; - } - - /** - * Setter for callTimeout. - * @param callTimeout Double value for callTimeout. - * @return Builder - */ - public Builder callTimeout(Double callTimeout) { - this.callTimeout = OptionalNullable.of(callTimeout); - return this; - } - - /** - * UnSetter for callTimeout. - * @return Builder - */ - public Builder unsetCallTimeout() { - callTimeout = null; - return this; - } - - /** - * Setter for callbackTimeout. - * @param callbackTimeout Double value for callbackTimeout. - * @return Builder - */ - public Builder callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - return this; - } - - /** - * UnSetter for callbackTimeout. - * @return Builder - */ - public Builder unsetCallbackTimeout() { - callbackTimeout = null; - return this; - } - - /** - * Setter for answerFallbackUrl. - * @param answerFallbackUrl String value for answerFallbackUrl. - * @return Builder - */ - public Builder answerFallbackUrl(String answerFallbackUrl) { - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - return this; - } - - /** - * UnSetter for answerFallbackUrl. - * @return Builder - */ - public Builder unsetAnswerFallbackUrl() { - answerFallbackUrl = null; - return this; - } - - /** - * Setter for username. - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for fallbackUsername. - * @param fallbackUsername String value for fallbackUsername. - * @return Builder - */ - public Builder fallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - return this; - } - - /** - * UnSetter for fallbackUsername. - * @return Builder - */ - public Builder unsetFallbackUsername() { - fallbackUsername = null; - return this; - } - - /** - * Setter for fallbackPassword. - * @param fallbackPassword String value for fallbackPassword. - * @return Builder - */ - public Builder fallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - return this; - } - - /** - * UnSetter for fallbackPassword. - * @return Builder - */ - public Builder unsetFallbackPassword() { - fallbackPassword = null; - return this; - } - - /** - * Setter for answerMethod. - * @param answerMethod AnswerMethodEnum value for answerMethod. - * @return Builder - */ - public Builder answerMethod(AnswerMethodEnum answerMethod) { - this.answerMethod = OptionalNullable.of(answerMethod); - return this; - } - - /** - * UnSetter for answerMethod. - * @return Builder - */ - public Builder unsetAnswerMethod() { - answerMethod = null; - return this; - } - - /** - * Setter for answerFallbackMethod. - * @param answerFallbackMethod AnswerFallbackMethodEnum value for answerFallbackMethod. - * @return Builder - */ - public Builder answerFallbackMethod(AnswerFallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - return this; - } - - /** - * UnSetter for answerFallbackMethod. - * @return Builder - */ - public Builder unsetAnswerFallbackMethod() { - answerFallbackMethod = null; - return this; - } - - /** - * Setter for disconnectUrl. - * @param disconnectUrl String value for disconnectUrl. - * @return Builder - */ - public Builder disconnectUrl(String disconnectUrl) { - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - return this; - } - - /** - * UnSetter for disconnectUrl. - * @return Builder - */ - public Builder unsetDisconnectUrl() { - disconnectUrl = null; - return this; - } - - /** - * Setter for disconnectMethod. - * @param disconnectMethod DisconnectMethodEnum value for disconnectMethod. - * @return Builder - */ - public Builder disconnectMethod(DisconnectMethodEnum disconnectMethod) { - this.disconnectMethod = OptionalNullable.of(disconnectMethod); - return this; - } - - /** - * UnSetter for disconnectMethod. - * @return Builder - */ - public Builder unsetDisconnectMethod() { - disconnectMethod = null; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = OptionalNullable.of(tag); - return this; - } - - /** - * UnSetter for tag. - * @return Builder - */ - public Builder unsetTag() { - tag = null; - return this; - } - - /** - * Setter for machineDetection. - * @param machineDetection MachineDetectionConfiguration value for machineDetection. - * @return Builder - */ - public Builder machineDetection(MachineDetectionConfiguration machineDetection) { - this.machineDetection = machineDetection; - return this; - } - - /** - * Setter for tag. - * @param priority Integer value for priority. - * @return Builder - */ - public Builder priority(Integer priority) { - this.priority = priority; - return this; - } - - /** - * UnSetter for priority. - * @return Builder - */ - public Builder unsetPriority() { - priority = null; - return this; - } - - /** - * Builds a new {@link CreateCallRequest} object using the set fields. - * @return {@link CreateCallRequest} - */ - public CreateCallRequest build() { - return new CreateCallRequest(from, to, answerUrl, applicationId, uui, callTimeout, - callbackTimeout, answerFallbackUrl, username, password, fallbackUsername, - fallbackPassword, answerMethod, answerFallbackMethod, disconnectUrl, - disconnectMethod, tag, machineDetection, priority); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/CreateCallResponse.java b/src/main/java/com/bandwidth/voice/models/CreateCallResponse.java deleted file mode 100644 index 400344fe..00000000 --- a/src/main/java/com/bandwidth/voice/models/CreateCallResponse.java +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.DateTimeHelper; -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.time.LocalDateTime; - -/** - * This is a model class for CreateCallResponse type. - */ -public class CreateCallResponse { - private String accountId; - private String callId; - private String applicationId; - private String to; - private String from; - private String callUrl; - private DisconnectMethodEnum disconnectMethod; - private String answerUrl; - private AnswerMethodEnum answerMethod; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private LocalDateTime enqueuedTime; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double callTimeout; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double callbackTimeout; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerFallbackUrl; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable answerFallbackMethod; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable disconnectUrl; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUsername; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackPassword; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable tag; - - @JsonInclude(JsonInclude.Include.NON_NULL) - private Integer priority; - - /** - * Default constructor. - */ - public CreateCallResponse() { - } - - /** - * Initialization constructor. - * @param accountId String value for accountId. - * @param callId String value for callId. - * @param applicationId String value for applicationId. - * @param to String value for to. - * @param from String value for from. - * @param callUrl String value for callUrl. - * @param answerUrl String value for answerUrl. - * @param answerMethod AnswerMethodEnum value for answerMethod. - * @param disconnectMethod DisconnectMethodEnum value for disconnectMethod. - * @param enqueuedTime LocalDateTime value for enqueuedTime. - * @param callTimeout Double value for callTimeout. - * @param callbackTimeout Double value for callbackTimeout. - * @param answerFallbackUrl String value for answerFallbackUrl. - * @param answerFallbackMethod AnswerFallbackMethodEnum value for answerFallbackMethod. - * @param disconnectUrl String value for disconnectUrl. - * @param username String value for username. - * @param password String value for password. - * @param fallbackUsername String value for fallbackUsername. - * @param fallbackPassword String value for fallbackPassword. - * @param tag String value for tag. - * @param priority Integer value for priority. - */ - public CreateCallResponse( - String accountId, - String callId, - String applicationId, - String to, - String from, - String callUrl, - String answerUrl, - AnswerMethodEnum answerMethod, - DisconnectMethodEnum disconnectMethod, - LocalDateTime enqueuedTime, - Double callTimeout, - Double callbackTimeout, - String answerFallbackUrl, - AnswerFallbackMethodEnum answerFallbackMethod, - String disconnectUrl, - String username, - String password, - String fallbackUsername, - String fallbackPassword, - String tag, - Integer priority) { - this.accountId = accountId; - this.callId = callId; - this.applicationId = applicationId; - this.to = to; - this.from = from; - this.enqueuedTime = enqueuedTime; - this.callUrl = callUrl; - this.callTimeout = callTimeout; - this.callbackTimeout = callbackTimeout; - this.answerUrl = answerUrl; - this.answerMethod = answerMethod; - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - this.disconnectMethod = disconnectMethod; - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - this.tag = OptionalNullable.of(tag); - this.priority = priority; - } - - /** - * Internal initialization constructor. - */ - protected CreateCallResponse(String accountId, String callId, String applicationId, String to, - String from, String callUrl, String answerUrl, AnswerMethodEnum answerMethod, - DisconnectMethodEnum disconnectMethod, LocalDateTime enqueuedTime, Double callTimeout, - Double callbackTimeout, OptionalNullable answerFallbackUrl, - OptionalNullable answerFallbackMethod, - OptionalNullable disconnectUrl, OptionalNullable username, - OptionalNullable password, OptionalNullable fallbackUsername, - OptionalNullable fallbackPassword, OptionalNullable tag, Integer priority) { - this.accountId = accountId; - this.callId = callId; - this.applicationId = applicationId; - this.to = to; - this.from = from; - this.enqueuedTime = enqueuedTime; - this.callUrl = callUrl; - this.callTimeout = callTimeout; - this.callbackTimeout = callbackTimeout; - this.answerUrl = answerUrl; - this.answerMethod = answerMethod; - this.answerFallbackUrl = answerFallbackUrl; - this.answerFallbackMethod = answerFallbackMethod; - this.disconnectUrl = disconnectUrl; - this.disconnectMethod = disconnectMethod; - this.username = username; - this.password = password; - this.fallbackUsername = fallbackUsername; - this.fallbackPassword = fallbackPassword; - this.tag = tag; - this.priority = priority; - } - - /** - * Getter for AccountId. - * @return Returns the String - */ - @JsonGetter("accountId") - public String getAccountId() { - return accountId; - } - - /** - * Setter for AccountId. - * @param accountId Value for String - */ - @JsonSetter("accountId") - public void setAccountId(String accountId) { - this.accountId = accountId; - } - - /** - * Getter for CallId. - * @return Returns the String - */ - @JsonGetter("callId") - public String getCallId() { - return callId; - } - - /** - * Setter for CallId. - * @param callId Value for String - */ - @JsonSetter("callId") - public void setCallId(String callId) { - this.callId = callId; - } - - /** - * Getter for ApplicationId. - * @return Returns the String - */ - @JsonGetter("applicationId") - public String getApplicationId() { - return applicationId; - } - - /** - * Setter for ApplicationId. - * @param applicationId Value for String - */ - @JsonSetter("applicationId") - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - /** - * Getter for To. - * @return Returns the String - */ - @JsonGetter("to") - public String getTo() { - return to; - } - - /** - * Setter for To. - * @param to Value for String - */ - @JsonSetter("to") - public void setTo(String to) { - this.to = to; - } - - /** - * Getter for From. - * @return Returns the String - */ - @JsonGetter("from") - public String getFrom() { - return from; - } - - /** - * Setter for From. - * @param from Value for String - */ - @JsonSetter("from") - public void setFrom(String from) { - this.from = from; - } - - /** - * Getter for EnqueuedTime. - * @return Returns the LocalDateTime - */ - @JsonGetter("enqueuedTime") - @JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class) - public LocalDateTime getEnqueuedTime() { - return enqueuedTime; - } - - /** - * Setter for EnqueuedTime. - * @param enqueuedTime Value for LocalDateTime - */ - @JsonSetter("enqueuedTime") - @JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class) - public void setEnqueuedTime(LocalDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; - } - - /** - * Getter for CallUrl. - * @return Returns the String - */ - @JsonGetter("callUrl") - public String getCallUrl() { - return callUrl; - } - - /** - * Setter for CallUrl. - * @param callUrl Value for String - */ - @JsonSetter("callUrl") - public void setCallUrl(String callUrl) { - this.callUrl = callUrl; - } - - /** - * Getter for CallTimeout. - * @return Returns the Double - */ - @JsonGetter("callTimeout") - public Double getCallTimeout() { - return callTimeout; - } - - /** - * Setter for CallTimeout. - * @param callTimeout Value for Double - */ - @JsonSetter("callTimeout") - public void setCallTimeout(Double callTimeout) { - this.callTimeout = callTimeout; - } - - /** - * Getter for CallbackTimeout. - * @return Returns the Double - */ - @JsonGetter("callbackTimeout") - public Double getCallbackTimeout() { - return callbackTimeout; - } - - /** - * Setter for CallbackTimeout. - * @param callbackTimeout Value for Double - */ - @JsonSetter("callbackTimeout") - public void setCallbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; - } - - /** - * Getter for AnswerUrl. - * @return Returns the String - */ - @JsonGetter("answerUrl") - public String getAnswerUrl() { - return answerUrl; - } - - /** - * Setter for AnswerUrl. - * @param answerUrl Value for String - */ - @JsonSetter("answerUrl") - public void setAnswerUrl(String answerUrl) { - this.answerUrl = answerUrl; - } - - /** - * Getter for AnswerMethod. - * @return Returns the AnswerMethodEnum - */ - @JsonGetter("answerMethod") - public AnswerMethodEnum getAnswerMethod() { - return answerMethod; - } - - /** - * Setter for AnswerMethod. - * @param answerMethod Value for AnswerMethodEnum - */ - @JsonSetter("answerMethod") - public void setAnswerMethod(AnswerMethodEnum answerMethod) { - this.answerMethod = answerMethod; - } - - /** - * Internal Getter for AnswerFallbackUrl. - * @return Returns the Internal String - */ - @JsonGetter("answerFallbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetAnswerFallbackUrl() { - return this.answerFallbackUrl; - } - - /** - * Getter for AnswerFallbackUrl. - * @return Returns the String - */ - public String getAnswerFallbackUrl() { - return OptionalNullable.getFrom(answerFallbackUrl); - } - - /** - * Setter for AnswerFallbackUrl. - * @param answerFallbackUrl Value for String - */ - @JsonSetter("answerFallbackUrl") - public void setAnswerFallbackUrl(String answerFallbackUrl) { - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - } - - /** - * UnSetter for AnswerFallbackUrl. - */ - public void unsetAnswerFallbackUrl() { - answerFallbackUrl = null; - } - - /** - * Internal Getter for AnswerFallbackMethod. - * @return Returns the Internal AnswerFallbackMethodEnum - */ - @JsonGetter("answerFallbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetAnswerFallbackMethod() { - return this.answerFallbackMethod; - } - - /** - * Getter for AnswerFallbackMethod. - * @return Returns the AnswerFallbackMethodEnum - */ - public AnswerFallbackMethodEnum getAnswerFallbackMethod() { - return OptionalNullable.getFrom(answerFallbackMethod); - } - - /** - * Setter for AnswerFallbackMethod. - * @param answerFallbackMethod Value for AnswerFallbackMethodEnum - */ - @JsonSetter("answerFallbackMethod") - public void setAnswerFallbackMethod(AnswerFallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - } - - /** - * UnSetter for AnswerFallbackMethod. - */ - public void unsetAnswerFallbackMethod() { - answerFallbackMethod = null; - } - - /** - * Internal Getter for DisconnectUrl. - * @return Returns the Internal String - */ - @JsonGetter("disconnectUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetDisconnectUrl() { - return this.disconnectUrl; - } - - /** - * Getter for DisconnectUrl. - * @return Returns the String - */ - public String getDisconnectUrl() { - return OptionalNullable.getFrom(disconnectUrl); - } - - /** - * Setter for DisconnectUrl. - * @param disconnectUrl Value for String - */ - @JsonSetter("disconnectUrl") - public void setDisconnectUrl(String disconnectUrl) { - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - } - - /** - * UnSetter for DisconnectUrl. - */ - public void unsetDisconnectUrl() { - disconnectUrl = null; - } - - /** - * Getter for DisconnectMethod. - * @return Returns the DisconnectMethodEnum - */ - @JsonGetter("disconnectMethod") - public DisconnectMethodEnum getDisconnectMethod() { - return disconnectMethod; - } - - /** - * Setter for DisconnectMethod. - * @param disconnectMethod Value for DisconnectMethodEnum - */ - @JsonSetter("disconnectMethod") - public void setDisconnectMethod(DisconnectMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; - } - - /** - * Internal Getter for Username. - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for FallbackUsername. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUsername") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUsername() { - return this.fallbackUsername; - } - - /** - * Getter for FallbackUsername. - * @return Returns the String - */ - public String getFallbackUsername() { - return OptionalNullable.getFrom(fallbackUsername); - } - - /** - * Setter for FallbackUsername. - * @param fallbackUsername Value for String - */ - @JsonSetter("fallbackUsername") - public void setFallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - } - - /** - * UnSetter for FallbackUsername. - */ - public void unsetFallbackUsername() { - fallbackUsername = null; - } - - /** - * Internal Getter for FallbackPassword. - * @return Returns the Internal String - */ - @JsonGetter("fallbackPassword") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackPassword() { - return this.fallbackPassword; - } - - /** - * Getter for FallbackPassword. - * @return Returns the String - */ - public String getFallbackPassword() { - return OptionalNullable.getFrom(fallbackPassword); - } - - /** - * Setter for FallbackPassword. - * @param fallbackPassword Value for String - */ - @JsonSetter("fallbackPassword") - public void setFallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * UnSetter for FallbackPassword. - */ - public void unsetFallbackPassword() { - fallbackPassword = null; - } - - /** - * Internal Getter for Tag. - * @return Returns the Internal String - */ - @JsonGetter("tag") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetTag() { - return this.tag; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - public String getTag() { - return OptionalNullable.getFrom(tag); - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = OptionalNullable.of(tag); - } - - /** - * UnSetter for Tag. - */ - public void unsetTag() { - tag = null; - } - - /** - * Internal Getter for Priority. - * @return Returns the Internal Integer - */ - @JsonGetter("priority") - protected Integer internalGetPriority() { - return this.priority; - } - - /** - * Getter for Priority. - * @return Returns the Integer - */ - @JsonGetter("priority") - public Integer getPriority() { return this.priority; } - - /** - * Setter for Priority. - * @param priority Value for Integer - */ - @JsonSetter("priority") - public void setPriority(Integer priority) { this.priority = priority; } - - /** - * UnSetter for Tag. - */ - public void unsetPriority() { - priority = null; - } - - /** - * Converts this CreateCallResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "CreateCallResponse [" + "accountId=" + accountId + ", callId=" + callId - + ", applicationId=" + applicationId + ", to=" + to + ", from=" + from - + ", callUrl=" + callUrl + ", answerUrl=" + answerUrl + ", answerMethod=" - + answerMethod + ", disconnectMethod=" + disconnectMethod + ", enqueuedTime=" - + enqueuedTime + ", callTimeout=" + callTimeout + ", callbackTimeout=" - + callbackTimeout + ", answerFallbackUrl=" + answerFallbackUrl - + ", answerFallbackMethod=" + answerFallbackMethod + ", disconnectUrl=" - + disconnectUrl + ", username=" + username + ", password=" + password - + ", fallbackUsername=" + fallbackUsername + ", fallbackPassword=" - + fallbackPassword + ", tag=" + tag + ", priority=" + priority + "]"; - } - - /** - * Builds a new {@link CreateCallResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link CreateCallResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(accountId, callId, applicationId, to, from, callUrl, - answerUrl, answerMethod, disconnectMethod) - .enqueuedTime(getEnqueuedTime()) - .callTimeout(getCallTimeout()) - .callbackTimeout(getCallbackTimeout()); - builder.answerFallbackUrl = internalGetAnswerFallbackUrl(); - builder.answerFallbackMethod = internalGetAnswerFallbackMethod(); - builder.disconnectUrl = internalGetDisconnectUrl(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.fallbackUsername = internalGetFallbackUsername(); - builder.fallbackPassword = internalGetFallbackPassword(); - builder.tag = internalGetTag(); - builder.priority = internalGetPriority(); - return builder; - } - - /** - * Class to build instances of {@link CreateCallResponse}. - */ - public static class Builder { - private String accountId; - private String callId; - private String applicationId; - private String to; - private String from; - private String callUrl; - private String answerUrl; - private AnswerMethodEnum answerMethod; - private DisconnectMethodEnum disconnectMethod; - private LocalDateTime enqueuedTime; - private Double callTimeout; - private Double callbackTimeout; - private OptionalNullable answerFallbackUrl; - private OptionalNullable answerFallbackMethod; - private OptionalNullable disconnectUrl; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable fallbackUsername; - private OptionalNullable fallbackPassword; - private OptionalNullable tag; - private Integer priority; - - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param accountId String value for accountId. - * @param callId String value for callId. - * @param applicationId String value for applicationId. - * @param to String value for to. - * @param from String value for from. - * @param callUrl String value for callUrl. - * @param answerUrl String value for answerUrl. - * @param answerMethod AnswerMethodEnum value for answerMethod. - * @param disconnectMethod DisconnectMethodEnum value for disconnectMethod. - */ - public Builder(String accountId, String callId, String applicationId, String to, - String from, String callUrl, String answerUrl, AnswerMethodEnum answerMethod, - DisconnectMethodEnum disconnectMethod) { - this.accountId = accountId; - this.callId = callId; - this.applicationId = applicationId; - this.to = to; - this.from = from; - this.callUrl = callUrl; - this.answerUrl = answerUrl; - this.answerMethod = answerMethod; - this.disconnectMethod = disconnectMethod; - } - - /** - * Setter for accountId. - * @param accountId String value for accountId. - * @return Builder - */ - public Builder accountId(String accountId) { - this.accountId = accountId; - return this; - } - - /** - * Setter for callId. - * @param callId String value for callId. - * @return Builder - */ - public Builder callId(String callId) { - this.callId = callId; - return this; - } - - /** - * Setter for applicationId. - * @param applicationId String value for applicationId. - * @return Builder - */ - public Builder applicationId(String applicationId) { - this.applicationId = applicationId; - return this; - } - - /** - * Setter for to. - * @param to String value for to. - * @return Builder - */ - public Builder to(String to) { - this.to = to; - return this; - } - - /** - * Setter for from. - * @param from String value for from. - * @return Builder - */ - public Builder from(String from) { - this.from = from; - return this; - } - - /** - * Setter for callUrl. - * @param callUrl String value for callUrl. - * @return Builder - */ - public Builder callUrl(String callUrl) { - this.callUrl = callUrl; - return this; - } - - /** - * Setter for answerUrl. - * @param answerUrl String value for answerUrl. - * @return Builder - */ - public Builder answerUrl(String answerUrl) { - this.answerUrl = answerUrl; - return this; - } - - /** - * Setter for answerMethod. - * @param answerMethod AnswerMethodEnum value for answerMethod. - * @return Builder - */ - public Builder answerMethod(AnswerMethodEnum answerMethod) { - this.answerMethod = answerMethod; - return this; - } - - /** - * Setter for disconnectMethod. - * @param disconnectMethod DisconnectMethodEnum value for disconnectMethod. - * @return Builder - */ - public Builder disconnectMethod(DisconnectMethodEnum disconnectMethod) { - this.disconnectMethod = disconnectMethod; - return this; - } - - /** - * Setter for enqueuedTime. - * @param enqueuedTime LocalDateTime value for enqueuedTime. - * @return Builder - */ - public Builder enqueuedTime(LocalDateTime enqueuedTime) { - this.enqueuedTime = enqueuedTime; - return this; - } - - /** - * Setter for callTimeout. - * @param callTimeout Double value for callTimeout. - * @return Builder - */ - public Builder callTimeout(Double callTimeout) { - this.callTimeout = callTimeout; - return this; - } - - /** - * Setter for callbackTimeout. - * @param callbackTimeout Double value for callbackTimeout. - * @return Builder - */ - public Builder callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = callbackTimeout; - return this; - } - - /** - * Setter for answerFallbackUrl. - * @param answerFallbackUrl String value for answerFallbackUrl. - * @return Builder - */ - public Builder answerFallbackUrl(String answerFallbackUrl) { - this.answerFallbackUrl = OptionalNullable.of(answerFallbackUrl); - return this; - } - - /** - * UnSetter for answerFallbackUrl. - * @return Builder - */ - public Builder unsetAnswerFallbackUrl() { - answerFallbackUrl = null; - return this; - } - - /** - * Setter for answerFallbackMethod. - * @param answerFallbackMethod AnswerFallbackMethodEnum value for answerFallbackMethod. - * @return Builder - */ - public Builder answerFallbackMethod(AnswerFallbackMethodEnum answerFallbackMethod) { - this.answerFallbackMethod = OptionalNullable.of(answerFallbackMethod); - return this; - } - - /** - * UnSetter for answerFallbackMethod. - * @return Builder - */ - public Builder unsetAnswerFallbackMethod() { - answerFallbackMethod = null; - return this; - } - - /** - * Setter for disconnectUrl. - * @param disconnectUrl String value for disconnectUrl. - * @return Builder - */ - public Builder disconnectUrl(String disconnectUrl) { - this.disconnectUrl = OptionalNullable.of(disconnectUrl); - return this; - } - - /** - * UnSetter for disconnectUrl. - * @return Builder - */ - public Builder unsetDisconnectUrl() { - disconnectUrl = null; - return this; - } - - /** - * Setter for username. - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for fallbackUsername. - * @param fallbackUsername String value for fallbackUsername. - * @return Builder - */ - public Builder fallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - return this; - } - - /** - * UnSetter for fallbackUsername. - * @return Builder - */ - public Builder unsetFallbackUsername() { - fallbackUsername = null; - return this; - } - - /** - * Setter for fallbackPassword. - * @param fallbackPassword String value for fallbackPassword. - * @return Builder - */ - public Builder fallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - return this; - } - - /** - * UnSetter for fallbackPassword. - * @return Builder - */ - public Builder unsetFallbackPassword() { - fallbackPassword = null; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = OptionalNullable.of(tag); - return this; - } - - /** - * UnSetter for tag. - * @return Builder - */ - public Builder unsetTag() { - tag = null; - return this; - } - - /** - * Setter for priority. - * @param priority Integer value for priority. - * @return Builder - */ - public Builder priority(Integer priority) { - this.priority = priority; - return this; - } - - /** - * UnSetter for tag. - * @return Builder - */ - public Builder unsetPriority() { - priority = null; - return this; - } - - /** - * Builds a new {@link CreateCallResponse} object using the set fields. - * @return {@link CreateCallResponse} - */ - public CreateCallResponse build() { - return new CreateCallResponse(accountId, callId, applicationId, to, from, callUrl, - answerUrl, answerMethod, disconnectMethod, enqueuedTime, callTimeout, - callbackTimeout, answerFallbackUrl, answerFallbackMethod, disconnectUrl, - username, password, fallbackUsername, fallbackPassword, tag, priority); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/DirectionEnum.java b/src/main/java/com/bandwidth/voice/models/DirectionEnum.java deleted file mode 100644 index d744a273..00000000 --- a/src/main/java/com/bandwidth/voice/models/DirectionEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * DirectionEnum to be used. - */ -public enum DirectionEnum { - INBOUND, - - OUTBOUND; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - INBOUND.value = "inbound"; - OUTBOUND.value = "outbound"; - - valueMap.put("inbound", INBOUND); - valueMap.put("outbound", OUTBOUND); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static DirectionEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of DirectionEnum values to list of string values. - * @param toConvert The list of DirectionEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (DirectionEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/DisconnectMethodEnum.java b/src/main/java/com/bandwidth/voice/models/DisconnectMethodEnum.java deleted file mode 100644 index ca9c8605..00000000 --- a/src/main/java/com/bandwidth/voice/models/DisconnectMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * DisconnectMethodEnum to be used. - */ -public enum DisconnectMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static DisconnectMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of DisconnectMethodEnum values to list of string values. - * @param toConvert The list of DisconnectMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (DisconnectMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/Diversion.java b/src/main/java/com/bandwidth/voice/models/Diversion.java deleted file mode 100644 index a1c348d8..00000000 --- a/src/main/java/com/bandwidth/voice/models/Diversion.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Diversion type. - */ -public class Diversion { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String reason; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String privacy; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String unknown; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String origTo; - - /** - * Default constructor. - */ - public Diversion() { - } - - /** - * Initialization constructor. - * @param reason String value for reason. - * @param privacy String value for privacy. - * @param unknown String value for unknown. - * @param origTo String value for origTo. - */ - public Diversion( - String reason, - String privacy, - String unknown, - String origTo) { - this.reason = reason; - this.privacy = privacy; - this.unknown = unknown; - this.origTo = origTo; - } - - /** - * Getter for Reason. - * @return Returns the String - */ - @JsonGetter("reason") - public String getReason() { - return reason; - } - - /** - * Setter for Reason. - * @param reason Value for String - */ - @JsonSetter("reason") - public void setReason(String reason) { - this.reason = reason; - } - - /** - * Getter for Privacy. - * @return Returns the String - */ - @JsonGetter("privacy") - public String getPrivacy() { - return privacy; - } - - /** - * Setter for Privacy. - * @param privacy Value for String - */ - @JsonSetter("privacy") - public void setPrivacy(String privacy) { - this.privacy = privacy; - } - - /** - * Getter for Unknown. - * @return Returns the String - */ - @JsonGetter("unknown") - public String getUnknown() { - return unknown; - } - - /** - * Setter for Unknown. - * @param unknown Value for String - */ - @JsonSetter("unknown") - public void setUnknown(String unknown) { - this.unknown = unknown; - } - - /** - * Getter for OrigTo. - * @return Returns the String - */ - @JsonGetter("origTo") - public String getOrigTo() { - return origTo; - } - - /** - * Setter for OrigTo. - * @param origTo Value for String - */ - @JsonSetter("origTo") - public void setOrigTo(String origTo) { - this.origTo = origTo; - } - - /** - * Converts this Diversion into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Diversion [" + "reason=" + reason + ", privacy=" + privacy + ", unknown=" + unknown - + ", origTo=" + origTo + "]"; - } - - /** - * Builds a new {@link Diversion.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Diversion.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .reason(getReason()) - .privacy(getPrivacy()) - .unknown(getUnknown()) - .origTo(getOrigTo()); - return builder; - } - - /** - * Class to build instances of {@link Diversion}. - */ - public static class Builder { - private String reason; - private String privacy; - private String unknown; - private String origTo; - - - - /** - * Setter for reason. - * @param reason String value for reason. - * @return Builder - */ - public Builder reason(String reason) { - this.reason = reason; - return this; - } - - /** - * Setter for privacy. - * @param privacy String value for privacy. - * @return Builder - */ - public Builder privacy(String privacy) { - this.privacy = privacy; - return this; - } - - /** - * Setter for unknown. - * @param unknown String value for unknown. - * @return Builder - */ - public Builder unknown(String unknown) { - this.unknown = unknown; - return this; - } - - /** - * Setter for origTo. - * @param origTo String value for origTo. - * @return Builder - */ - public Builder origTo(String origTo) { - this.origTo = origTo; - return this; - } - - /** - * Builds a new {@link Diversion} object using the set fields. - * @return {@link Diversion} - */ - public Diversion build() { - return new Diversion(reason, privacy, unknown, origTo); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/DynamicResponse.java b/src/main/java/com/bandwidth/voice/models/DynamicResponse.java deleted file mode 100644 index 0788d893..00000000 --- a/src/main/java/com/bandwidth/voice/models/DynamicResponse.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.ApiHelper; -import com.bandwidth.http.Headers; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import java.io.IOException; -import java.io.InputStream; -import java.text.ParseException; -import java.util.Map; - -/** - * Represents dynamic response returned by an API call. - * Allows user to lazily parse the response as a primitive - * or a more complex type using parse(). - */ -public class DynamicResponse { - private HttpResponse response; - private String responseString; - - /** - * Instantiate class. - * @param responseBody The object of HttpResponse - */ - public DynamicResponse(HttpResponse responseBody) { - this.response = responseBody; - } - - /** - * Parse response as instance of class cls. - * @param The type of class to be parsed - * @param cls Class to be parsed - * @return Object of type T - * @throws ParseException Signals if a parse exception occured - */ - public T parse(Class cls) throws ParseException { - try { - return ApiHelper.deserialize(getResponseString(), cls); - } catch (Exception e) { - throw new java.text.ParseException("Could not deserialize dynamic content as given type", 0); - } - } - - /** - * Parse response as boolean. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public boolean parseAsBoolean() throws ParseException { - return this.parse(Boolean.class); - } - - /** - * Parse response as boolean. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public byte parseAsByte() throws ParseException { - return this.parse(Byte.class); - } - - /** - * Parse response as character. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public char parseAsCharacter() throws ParseException { - return this.parse(Character.class); - } - - /** - * Parse response as float. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public float parseAsFloat() throws ParseException { - return this.parse(Float.class); - } - - /** - * Parse response as integer. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public int parseAsInteger() throws ParseException { - return this.parse(Integer.class); - } - - /** - * Parse response as long. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public long parseAsLong() throws ParseException { - return this.parse(Long.class); - } - - /** - * Parse response as short. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public short parseAsShort() throws ParseException { - return this.parse(Short.class); - } - - /** - * Parse response as double. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public double parseAsDouble() throws ParseException { - return this.parse(Double.class); - } - - /** - * Parse response as string. - * @return Parsed value - * @throws ParseException Signals if a parse exception occured - */ - public String parseAsString() throws ParseException { - try { - return getResponseString(); - } catch (Throwable e) { - throw new java.text.ParseException("Could not deserialize dynamic content as given type", 0); - } - } - - /** - * Parse response as a map of keys and values. - * @return Parsed map - * @throws ParseException Signals if a parse exception occured - */ - public Map parseAsDictionary() throws ParseException { - try { - return ApiHelper.deserialize(getResponseString()); - } catch (IOException e) { - throw new java.text.ParseException("Could not deserialize dynamic content as given type", 0); - } - } - - /** - * Get the raw stream for the response body. - * @return Raw body - */ - public InputStream getRawBody() { - return response.getRawBody(); - } - - /** - * Get response headers for the HTTP response. - * @return Headers - */ - public Headers getHeaders() { - return response.getHeaders(); - } - - /** - * Get response as string. - * @return The Response String - */ - private String getResponseString() { - if (responseString == null) { - responseString = ((HttpStringResponse) response).getBody(); - } - return responseString; - } -} diff --git a/src/main/java/com/bandwidth/voice/models/FallbackMethodEnum.java b/src/main/java/com/bandwidth/voice/models/FallbackMethodEnum.java deleted file mode 100644 index ea38abfe..00000000 --- a/src/main/java/com/bandwidth/voice/models/FallbackMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * FallbackMethodEnum to be used. - */ -public enum FallbackMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static FallbackMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of FallbackMethodEnum values to list of string values. - * @param toConvert The list of FallbackMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (FallbackMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/FileFormatEnum.java b/src/main/java/com/bandwidth/voice/models/FileFormatEnum.java deleted file mode 100644 index 61e8edf6..00000000 --- a/src/main/java/com/bandwidth/voice/models/FileFormatEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * FileFormatEnum to be used. - */ -public enum FileFormatEnum { - MP3, - - WAV; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - MP3.value = "mp3"; - WAV.value = "wav"; - - valueMap.put("mp3", MP3); - valueMap.put("wav", WAV); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static FileFormatEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of FileFormatEnum values to list of string values. - * @param toConvert The list of FileFormatEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (FileFormatEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/MachineDetectionConfiguration.java b/src/main/java/com/bandwidth/voice/models/MachineDetectionConfiguration.java deleted file mode 100644 index 1be3a861..00000000 --- a/src/main/java/com/bandwidth/voice/models/MachineDetectionConfiguration.java +++ /dev/null @@ -1,831 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * This is a model class for MachineDetectionConfiguration type. - */ -public class MachineDetectionConfiguration { - @JsonInclude(JsonInclude.Include.NON_NULL) - private ModeEnum mode; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double detectionTimeout; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double silenceTimeout; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double speechThreshold; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double speechEndThreshold; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Boolean delayResult; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUsername; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackPassword; - - /** - * Default constructor. - */ - public MachineDetectionConfiguration() { - } - - /** - * Initialization constructor. - * @param mode ModeEnum value for mode. - * @param detectionTimeout Double value for detectionTimeout. - * @param silenceTimeout Double value for silenceTimeout. - * @param speechThreshold Double value for speechThreshold. - * @param speechEndThreshold Double value for speechEndThreshold. - * @param delayResult Boolean value for delayResult. - * @param callbackUrl String value for callbackUrl. - * @param callbackMethod CallbackMethodEnum value for callbackMethod. - * @param fallbackUrl String value for fallbackUrl. - * @param fallbackMethod FallbackMethodEnum value for fallbackMethod. - * @param username String value for username. - * @param password String value for password. - * @param fallbackUsername String value for fallbackUsername. - * @param fallbackPassword String value for fallbackPassword. - */ - public MachineDetectionConfiguration( - ModeEnum mode, - Double detectionTimeout, - Double silenceTimeout, - Double speechThreshold, - Double speechEndThreshold, - Boolean delayResult, - String callbackUrl, - CallbackMethodEnum callbackMethod, - String fallbackUrl, - FallbackMethodEnum fallbackMethod, - String username, - String password, - String fallbackUsername, - String fallbackPassword) { - this.mode = mode; - this.detectionTimeout = detectionTimeout; - this.silenceTimeout = silenceTimeout; - this.speechThreshold = speechThreshold; - this.speechEndThreshold = speechEndThreshold; - this.delayResult = delayResult; - this.callbackUrl = OptionalNullable.of(callbackUrl); - this.callbackMethod = OptionalNullable.of(callbackMethod); - this.fallbackUrl = OptionalNullable.of(fallbackUrl); - this.fallbackMethod = OptionalNullable.of(fallbackMethod); - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * Internal initialization constructor. - */ - protected MachineDetectionConfiguration(ModeEnum mode, Double detectionTimeout, Double silenceTimeout, - Double speechThreshold, Double speechEndThreshold, Boolean delayResult, - OptionalNullable callbackUrl, - OptionalNullable callbackMethod, - OptionalNullable fallbackUrl, - OptionalNullable fallbackMethod, OptionalNullable username, - OptionalNullable password, OptionalNullable fallbackUsername, - OptionalNullable fallbackPassword) { - this.mode = mode; - this.detectionTimeout = detectionTimeout; - this.silenceTimeout = silenceTimeout; - this.speechThreshold = speechThreshold; - this.speechEndThreshold = speechEndThreshold; - this.delayResult = delayResult; - this.callbackUrl = callbackUrl; - this.callbackMethod = callbackMethod; - this.fallbackUrl = fallbackUrl; - this.fallbackMethod = fallbackMethod; - this.username = username; - this.password = password; - this.fallbackUsername = fallbackUsername; - this.fallbackPassword = fallbackPassword; - } - - /** - * Getter for Mode. - * The machine detection mode. If set to 'async', the detection result will be sent in a - * 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for - * the machine detection to complete and will include its result. Default is 'async'. - * @return Returns the ModeEnum - */ - @JsonGetter("mode") - public ModeEnum getMode() { - return mode; - } - - /** - * Setter for Mode. - * The machine detection mode. If set to 'async', the detection result will be sent in a - * 'machineDetectionComplete' callback. If set to 'sync', the 'answer' callback will wait for - * the machine detection to complete and will include its result. Default is 'async'. - * @param mode Value for ModeEnum - */ - @JsonSetter("mode") - public void setMode(ModeEnum mode) { - this.mode = mode; - } - - /** - * Getter for DetectionTimeout. - * Total amount of time (in seconds) before giving up. - * @return Returns the Double - */ - @JsonGetter("detectionTimeout") - public Double getDetectionTimeout() { - return detectionTimeout; - } - - /** - * Setter for DetectionTimeout. - * Total amount of time (in seconds) before giving up. - * @param detectionTimeout Value for Double - */ - @JsonSetter("detectionTimeout") - public void setDetectionTimeout(Double detectionTimeout) { - this.detectionTimeout = detectionTimeout; - } - - /** - * Getter for SilenceTimeout. - * If no speech is detected in this period, a callback with a 'silence' result is sent. Default - * is 10 seconds. - * @return Returns the Double - */ - @JsonGetter("silenceTimeout") - public Double getSilenceTimeout() { - return silenceTimeout; - } - - /** - * Setter for SilenceTimeout. - * If no speech is detected in this period, a callback with a 'silence' result is sent. Default - * is 10 seconds. - * @param silenceTimeout Value for Double - */ - @JsonSetter("silenceTimeout") - public void setSilenceTimeout(Double silenceTimeout) { - this.silenceTimeout = silenceTimeout; - } - - /** - * Getter for SpeechThreshold. - * When speech has ended and a result couldn't be determined based on the audio content itself, - * this value is used to determine if the speaker is a machine based on the speech duration. If - * the length of the speech detected is greater than or equal to this threshold, the result will - * be 'answering-machine'. If the length of speech detected is below this threshold, the result - * will be 'human'. Default is 10 seconds. - * @return Returns the Double - */ - @JsonGetter("speechThreshold") - public Double getSpeechThreshold() { - return speechThreshold; - } - - /** - * Setter for SpeechThreshold. - * When speech has ended and a result couldn't be determined based on the audio content itself, - * this value is used to determine if the speaker is a machine based on the speech duration. If - * the length of the speech detected is greater than or equal to this threshold, the result will - * be 'answering-machine'. If the length of speech detected is below this threshold, the result - * will be 'human'. Default is 10 seconds. - * @param speechThreshold Value for Double - */ - @JsonSetter("speechThreshold") - public void setSpeechThreshold(Double speechThreshold) { - this.speechThreshold = speechThreshold; - } - - /** - * Getter for SpeechEndThreshold. - * Amount of silence (in seconds) before assuming the callee has finished speaking. - * @return Returns the Double - */ - @JsonGetter("speechEndThreshold") - public Double getSpeechEndThreshold() { - return speechEndThreshold; - } - - /** - * Setter for SpeechEndThreshold. - * Amount of silence (in seconds) before assuming the callee has finished speaking. - * @param speechEndThreshold Value for Double - */ - @JsonSetter("speechEndThreshold") - public void setSpeechEndThreshold(Double speechEndThreshold) { - this.speechEndThreshold = speechEndThreshold; - } - - /** - * Getter for DelayResult. - * If set to 'true' and if an answering machine is detected, the 'answering-machine' callback - * will be delayed until the machine is done speaking or until the 'detectionTimeout' is - * exceeded. If false, the 'answering-machine' result is sent immediately. Default is 'false'. - * @return Returns the Boolean - */ - @JsonGetter("delayResult") - public Boolean getDelayResult() { - return delayResult; - } - - /** - * Setter for DelayResult. - * If set to 'true' and if an answering machine is detected, the 'answering-machine' callback - * will be delayed until the machine is done speaking or until the 'detectionTimeout' is - * exceeded. If false, the 'answering-machine' result is sent immediately. Default is 'false'. - * @param delayResult Value for Boolean - */ - @JsonSetter("delayResult") - public void setDelayResult(Boolean delayResult) { - this.delayResult = delayResult; - } - - /** - * Internal Getter for CallbackUrl. - * The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only - * for 'async' mode. - * @return Returns the Internal String - */ - @JsonGetter("callbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackUrl() { - return this.callbackUrl; - } - - /** - * Getter for CallbackUrl. - * The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only - * for 'async' mode. - * @return Returns the String - */ - public String getCallbackUrl() { - return OptionalNullable.getFrom(callbackUrl); - } - - /** - * Setter for CallbackUrl. - * The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only - * for 'async' mode. - * @param callbackUrl Value for String - */ - @JsonSetter("callbackUrl") - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalNullable.of(callbackUrl); - } - - /** - * UnSetter for CallbackUrl. - * The URL to send the 'machineDetectionComplete' callback when the detection is completed. Only - * for 'async' mode. - */ - public void unsetCallbackUrl() { - callbackUrl = null; - } - - /** - * Internal Getter for CallbackMethod. - * @return Returns the Internal CallbackMethodEnum - */ - @JsonGetter("callbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackMethod() { - return this.callbackMethod; - } - - /** - * Getter for CallbackMethod. - * @return Returns the CallbackMethodEnum - */ - public CallbackMethodEnum getCallbackMethod() { - return OptionalNullable.getFrom(callbackMethod); - } - - /** - * Setter for CallbackMethod. - * @param callbackMethod Value for CallbackMethodEnum - */ - @JsonSetter("callbackMethod") - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = OptionalNullable.of(callbackMethod); - } - - /** - * UnSetter for CallbackMethod. - */ - public void unsetCallbackMethod() { - callbackMethod = null; - } - - /** - * Internal Getter for FallbackUrl. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUrl() { - return this.fallbackUrl; - } - - /** - * Getter for FallbackUrl. - * @return Returns the String - */ - public String getFallbackUrl() { - return OptionalNullable.getFrom(fallbackUrl); - } - - /** - * Setter for FallbackUrl. - * @param fallbackUrl Value for String - */ - @JsonSetter("fallbackUrl") - public void setFallbackUrl(String fallbackUrl) { - this.fallbackUrl = OptionalNullable.of(fallbackUrl); - } - - /** - * UnSetter for FallbackUrl. - */ - public void unsetFallbackUrl() { - fallbackUrl = null; - } - - /** - * Internal Getter for FallbackMethod. - * @return Returns the Internal FallbackMethodEnum - */ - @JsonGetter("fallbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackMethod() { - return this.fallbackMethod; - } - - /** - * Getter for FallbackMethod. - * @return Returns the FallbackMethodEnum - */ - public FallbackMethodEnum getFallbackMethod() { - return OptionalNullable.getFrom(fallbackMethod); - } - - /** - * Setter for FallbackMethod. - * @param fallbackMethod Value for FallbackMethodEnum - */ - @JsonSetter("fallbackMethod") - public void setFallbackMethod(FallbackMethodEnum fallbackMethod) { - this.fallbackMethod = OptionalNullable.of(fallbackMethod); - } - - /** - * UnSetter for FallbackMethod. - */ - public void unsetFallbackMethod() { - fallbackMethod = null; - } - - /** - * Internal Getter for Username. - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for FallbackUsername. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUsername") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUsername() { - return this.fallbackUsername; - } - - /** - * Getter for FallbackUsername. - * @return Returns the String - */ - public String getFallbackUsername() { - return OptionalNullable.getFrom(fallbackUsername); - } - - /** - * Setter for FallbackUsername. - * @param fallbackUsername Value for String - */ - @JsonSetter("fallbackUsername") - public void setFallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - } - - /** - * UnSetter for FallbackUsername. - */ - public void unsetFallbackUsername() { - fallbackUsername = null; - } - - /** - * Internal Getter for FallbackPassword. - * @return Returns the Internal String - */ - @JsonGetter("fallbackPassword") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackPassword() { - return this.fallbackPassword; - } - - /** - * Getter for FallbackPassword. - * @return Returns the String - */ - public String getFallbackPassword() { - return OptionalNullable.getFrom(fallbackPassword); - } - - /** - * Setter for FallbackPassword. - * @param fallbackPassword Value for String - */ - @JsonSetter("fallbackPassword") - public void setFallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * UnSetter for FallbackPassword. - */ - public void unsetFallbackPassword() { - fallbackPassword = null; - } - - /** - * Converts this MachineDetectionConfiguration into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "MachineDetectionConfiguration [" + "mode=" + mode + ", detectionTimeout=" - + detectionTimeout + ", silenceTimeout=" + silenceTimeout + ", speechThreshold=" - + speechThreshold + ", speechEndThreshold=" + speechEndThreshold + ", delayResult=" - + delayResult + ", callbackUrl=" + callbackUrl + ", callbackMethod=" - + callbackMethod + ", fallbackUrl=" + fallbackUrl + ", fallbackMethod=" - + fallbackMethod + ", username=" + username + ", password=" + password - + ", fallbackUsername=" + fallbackUsername + ", fallbackPassword=" - + fallbackPassword + "]"; - } - - /** - * Builds a new {@link MachineDetectionConfiguration.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link MachineDetectionConfiguration.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .mode(getMode()) - .detectionTimeout(getDetectionTimeout()) - .silenceTimeout(getSilenceTimeout()) - .speechThreshold(getSpeechThreshold()) - .speechEndThreshold(getSpeechEndThreshold()) - .delayResult(getDelayResult()); - builder.callbackUrl = internalGetCallbackUrl(); - builder.callbackMethod = internalGetCallbackMethod(); - builder.fallbackUrl = internalGetFallbackUrl(); - builder.fallbackMethod = internalGetFallbackMethod(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.fallbackUsername = internalGetFallbackUsername(); - builder.fallbackPassword = internalGetFallbackPassword(); - return builder; - } - - /** - * Class to build instances of {@link MachineDetectionConfiguration}. - */ - public static class Builder { - private ModeEnum mode; - private Double detectionTimeout; - private Double silenceTimeout; - private Double speechThreshold; - private Double speechEndThreshold; - private Boolean delayResult; - private OptionalNullable callbackUrl; - private OptionalNullable callbackMethod; - private OptionalNullable fallbackUrl; - private OptionalNullable fallbackMethod; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable fallbackUsername; - private OptionalNullable fallbackPassword; - - - - /** - * Setter for mode. - * @param mode ModeEnum value for mode. - * @return Builder - */ - public Builder mode(ModeEnum mode) { - this.mode = mode; - return this; - } - - /** - * Setter for detectionTimeout. - * @param detectionTimeout Double value for detectionTimeout. - * @return Builder - */ - public Builder detectionTimeout(Double detectionTimeout) { - this.detectionTimeout = detectionTimeout; - return this; - } - - /** - * Setter for silenceTimeout. - * @param silenceTimeout Double value for silenceTimeout. - * @return Builder - */ - public Builder silenceTimeout(Double silenceTimeout) { - this.silenceTimeout = silenceTimeout; - return this; - } - - /** - * Setter for speechThreshold. - * @param speechThreshold Double value for speechThreshold. - * @return Builder - */ - public Builder speechThreshold(Double speechThreshold) { - this.speechThreshold = speechThreshold; - return this; - } - - /** - * Setter for speechEndThreshold. - * @param speechEndThreshold Double value for speechEndThreshold. - * @return Builder - */ - public Builder speechEndThreshold(Double speechEndThreshold) { - this.speechEndThreshold = speechEndThreshold; - return this; - } - - /** - * Setter for delayResult. - * @param delayResult Boolean value for delayResult. - * @return Builder - */ - public Builder delayResult(Boolean delayResult) { - this.delayResult = delayResult; - return this; - } - - /** - * Setter for callbackUrl. - * @param callbackUrl String value for callbackUrl. - * @return Builder - */ - public Builder callbackUrl(String callbackUrl) { - this.callbackUrl = OptionalNullable.of(callbackUrl); - return this; - } - - /** - * UnSetter for callbackUrl. - * @return Builder - */ - public Builder unsetCallbackUrl() { - callbackUrl = null; - return this; - } - - /** - * Setter for callbackMethod. - * @param callbackMethod CallbackMethodEnum value for callbackMethod. - * @return Builder - */ - public Builder callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = OptionalNullable.of(callbackMethod); - return this; - } - - /** - * UnSetter for callbackMethod. - * @return Builder - */ - public Builder unsetCallbackMethod() { - callbackMethod = null; - return this; - } - - /** - * Setter for fallbackUrl. - * @param fallbackUrl String value for fallbackUrl. - * @return Builder - */ - public Builder fallbackUrl(String fallbackUrl) { - this.fallbackUrl = OptionalNullable.of(fallbackUrl); - return this; - } - - /** - * UnSetter for fallbackUrl. - * @return Builder - */ - public Builder unsetFallbackUrl() { - fallbackUrl = null; - return this; - } - - /** - * Setter for fallbackMethod. - * @param fallbackMethod FallbackMethodEnum value for fallbackMethod. - * @return Builder - */ - public Builder fallbackMethod(FallbackMethodEnum fallbackMethod) { - this.fallbackMethod = OptionalNullable.of(fallbackMethod); - return this; - } - - /** - * UnSetter for fallbackMethod. - * @return Builder - */ - public Builder unsetFallbackMethod() { - fallbackMethod = null; - return this; - } - - /** - * Setter for username. - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for fallbackUsername. - * @param fallbackUsername String value for fallbackUsername. - * @return Builder - */ - public Builder fallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - return this; - } - - /** - * UnSetter for fallbackUsername. - * @return Builder - */ - public Builder unsetFallbackUsername() { - fallbackUsername = null; - return this; - } - - /** - * Setter for fallbackPassword. - * @param fallbackPassword String value for fallbackPassword. - * @return Builder - */ - public Builder fallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - return this; - } - - /** - * UnSetter for fallbackPassword. - * @return Builder - */ - public Builder unsetFallbackPassword() { - fallbackPassword = null; - return this; - } - - /** - * Builds a new {@link MachineDetectionConfiguration} object using the set fields. - * @return {@link MachineDetectionConfiguration} - */ - public MachineDetectionConfiguration build() { - return new MachineDetectionConfiguration(mode, detectionTimeout, silenceTimeout, - speechThreshold, speechEndThreshold, delayResult, callbackUrl, callbackMethod, - fallbackUrl, fallbackMethod, username, password, fallbackUsername, - fallbackPassword); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ModeEnum.java b/src/main/java/com/bandwidth/voice/models/ModeEnum.java deleted file mode 100644 index 06d2e40f..00000000 --- a/src/main/java/com/bandwidth/voice/models/ModeEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * ModeEnum to be used. - */ -public enum ModeEnum { - SYNC, - - ASYNC; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - SYNC.value = "sync"; - ASYNC.value = "async"; - - valueMap.put("sync", SYNC); - valueMap.put("async", ASYNC); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static ModeEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of ModeEnum values to list of string values. - * @param toConvert The list of ModeEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (ModeEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/ModifyCallRecordingRequest.java b/src/main/java/com/bandwidth/voice/models/ModifyCallRecordingRequest.java deleted file mode 100644 index b2a3451d..00000000 --- a/src/main/java/com/bandwidth/voice/models/ModifyCallRecordingRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ModifyCallRecordingRequest type. - */ -public class ModifyCallRecordingRequest { - private State1Enum state; - - /** - * Default constructor. - */ - public ModifyCallRecordingRequest() { - } - - /** - * Initialization constructor. - * @param state State1Enum value for state. - */ - public ModifyCallRecordingRequest( - State1Enum state) { - this.state = state; - } - - /** - * Getter for State. - * @return Returns the State1Enum - */ - @JsonGetter("state") - public State1Enum getState() { - return state; - } - - /** - * Setter for State. - * @param state Value for State1Enum - */ - @JsonSetter("state") - public void setState(State1Enum state) { - this.state = state; - } - - /** - * Converts this ModifyCallRecordingRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ModifyCallRecordingRequest [" + "state=" + state + "]"; - } - - /** - * Builds a new {@link ModifyCallRecordingRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ModifyCallRecordingRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(state); - return builder; - } - - /** - * Class to build instances of {@link ModifyCallRecordingRequest}. - */ - public static class Builder { - private State1Enum state; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param state State1Enum value for state. - */ - public Builder(State1Enum state) { - this.state = state; - } - - /** - * Setter for state. - * @param state State1Enum value for state. - * @return Builder - */ - public Builder state(State1Enum state) { - this.state = state; - return this; - } - - /** - * Builds a new {@link ModifyCallRecordingRequest} object using the set fields. - * @return {@link ModifyCallRecordingRequest} - */ - public ModifyCallRecordingRequest build() { - return new ModifyCallRecordingRequest(state); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ModifyCallRequest.java b/src/main/java/com/bandwidth/voice/models/ModifyCallRequest.java deleted file mode 100644 index 3fceffe1..00000000 --- a/src/main/java/com/bandwidth/voice/models/ModifyCallRequest.java +++ /dev/null @@ -1,701 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * This is a model class for ModifyCallRequest type. - */ -public class ModifyCallRequest { - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable state; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectFallbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectFallbackMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUsername; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackPassword; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable tag; - - /** - * Default constructor. - */ - public ModifyCallRequest() { - state = OptionalNullable.of(StateEnum.ACTIVE); - } - - /** - * Initialization constructor. - * @param state StateEnum value for state. - * @param redirectUrl String value for redirectUrl. - * @param redirectFallbackUrl String value for redirectFallbackUrl. - * @param redirectMethod RedirectMethodEnum value for redirectMethod. - * @param redirectFallbackMethod RedirectFallbackMethodEnum value for redirectFallbackMethod. - * @param username String value for username. - * @param password String value for password. - * @param fallbackUsername String value for fallbackUsername. - * @param fallbackPassword String value for fallbackPassword. - * @param tag String value for tag. - */ - public ModifyCallRequest( - StateEnum state, - String redirectUrl, - String redirectFallbackUrl, - RedirectMethodEnum redirectMethod, - RedirectFallbackMethodEnum redirectFallbackMethod, - String username, - String password, - String fallbackUsername, - String fallbackPassword, - String tag) { - this.state = OptionalNullable.of(state); - this.redirectUrl = OptionalNullable.of(redirectUrl); - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - this.redirectMethod = OptionalNullable.of(redirectMethod); - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - this.tag = OptionalNullable.of(tag); - } - - /** - * Internal initialization constructor. - */ - protected ModifyCallRequest(OptionalNullable state, - OptionalNullable redirectUrl, OptionalNullable redirectFallbackUrl, - OptionalNullable redirectMethod, - OptionalNullable redirectFallbackMethod, - OptionalNullable username, OptionalNullable password, - OptionalNullable fallbackUsername, OptionalNullable fallbackPassword, - OptionalNullable tag) { - this.state = state; - this.redirectUrl = redirectUrl; - this.redirectFallbackUrl = redirectFallbackUrl; - this.redirectMethod = redirectMethod; - this.redirectFallbackMethod = redirectFallbackMethod; - this.username = username; - this.password = password; - this.fallbackUsername = fallbackUsername; - this.fallbackPassword = fallbackPassword; - this.tag = tag; - } - - /** - * Internal Getter for State. - * @return Returns the Internal StateEnum - */ - @JsonGetter("state") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetState() { - return this.state; - } - - /** - * Getter for State. - * @return Returns the StateEnum - */ - public StateEnum getState() { - return OptionalNullable.getFrom(state); - } - - /** - * Setter for State. - * @param state Value for StateEnum - */ - @JsonSetter("state") - public void setState(StateEnum state) { - this.state = OptionalNullable.of(state); - } - - /** - * UnSetter for State. - */ - public void unsetState() { - state = null; - } - - /** - * Internal Getter for RedirectUrl. - * Required if state is 'active' - * @return Returns the Internal String - */ - @JsonGetter("redirectUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectUrl() { - return this.redirectUrl; - } - - /** - * Getter for RedirectUrl. - * Required if state is 'active' - * @return Returns the String - */ - public String getRedirectUrl() { - return OptionalNullable.getFrom(redirectUrl); - } - - /** - * Setter for RedirectUrl. - * Required if state is 'active' - * @param redirectUrl Value for String - */ - @JsonSetter("redirectUrl") - public void setRedirectUrl(String redirectUrl) { - this.redirectUrl = OptionalNullable.of(redirectUrl); - } - - /** - * UnSetter for RedirectUrl. - * Required if state is 'active' - */ - public void unsetRedirectUrl() { - redirectUrl = null; - } - - /** - * Internal Getter for RedirectFallbackUrl. - * @return Returns the Internal String - */ - @JsonGetter("redirectFallbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectFallbackUrl() { - return this.redirectFallbackUrl; - } - - /** - * Getter for RedirectFallbackUrl. - * @return Returns the String - */ - public String getRedirectFallbackUrl() { - return OptionalNullable.getFrom(redirectFallbackUrl); - } - - /** - * Setter for RedirectFallbackUrl. - * @param redirectFallbackUrl Value for String - */ - @JsonSetter("redirectFallbackUrl") - public void setRedirectFallbackUrl(String redirectFallbackUrl) { - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - } - - /** - * UnSetter for RedirectFallbackUrl. - */ - public void unsetRedirectFallbackUrl() { - redirectFallbackUrl = null; - } - - /** - * Internal Getter for RedirectMethod. - * @return Returns the Internal RedirectMethodEnum - */ - @JsonGetter("redirectMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectMethod() { - return this.redirectMethod; - } - - /** - * Getter for RedirectMethod. - * @return Returns the RedirectMethodEnum - */ - public RedirectMethodEnum getRedirectMethod() { - return OptionalNullable.getFrom(redirectMethod); - } - - /** - * Setter for RedirectMethod. - * @param redirectMethod Value for RedirectMethodEnum - */ - @JsonSetter("redirectMethod") - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = OptionalNullable.of(redirectMethod); - } - - /** - * UnSetter for RedirectMethod. - */ - public void unsetRedirectMethod() { - redirectMethod = null; - } - - /** - * Internal Getter for RedirectFallbackMethod. - * @return Returns the Internal RedirectFallbackMethodEnum - */ - @JsonGetter("redirectFallbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectFallbackMethod() { - return this.redirectFallbackMethod; - } - - /** - * Getter for RedirectFallbackMethod. - * @return Returns the RedirectFallbackMethodEnum - */ - public RedirectFallbackMethodEnum getRedirectFallbackMethod() { - return OptionalNullable.getFrom(redirectFallbackMethod); - } - - /** - * Setter for RedirectFallbackMethod. - * @param redirectFallbackMethod Value for RedirectFallbackMethodEnum - */ - @JsonSetter("redirectFallbackMethod") - public void setRedirectFallbackMethod(RedirectFallbackMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - } - - /** - * UnSetter for RedirectFallbackMethod. - */ - public void unsetRedirectFallbackMethod() { - redirectFallbackMethod = null; - } - - /** - * Internal Getter for Username. - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for FallbackUsername. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUsername") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUsername() { - return this.fallbackUsername; - } - - /** - * Getter for FallbackUsername. - * @return Returns the String - */ - public String getFallbackUsername() { - return OptionalNullable.getFrom(fallbackUsername); - } - - /** - * Setter for FallbackUsername. - * @param fallbackUsername Value for String - */ - @JsonSetter("fallbackUsername") - public void setFallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - } - - /** - * UnSetter for FallbackUsername. - */ - public void unsetFallbackUsername() { - fallbackUsername = null; - } - - /** - * Internal Getter for FallbackPassword. - * @return Returns the Internal String - */ - @JsonGetter("fallbackPassword") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackPassword() { - return this.fallbackPassword; - } - - /** - * Getter for FallbackPassword. - * @return Returns the String - */ - public String getFallbackPassword() { - return OptionalNullable.getFrom(fallbackPassword); - } - - /** - * Setter for FallbackPassword. - * @param fallbackPassword Value for String - */ - @JsonSetter("fallbackPassword") - public void setFallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * UnSetter for FallbackPassword. - */ - public void unsetFallbackPassword() { - fallbackPassword = null; - } - - /** - * Internal Getter for Tag. - * @return Returns the Internal String - */ - @JsonGetter("tag") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetTag() { - return this.tag; - } - - /** - * Getter for Tag. - * @return Returns the String - */ - public String getTag() { - return OptionalNullable.getFrom(tag); - } - - /** - * Setter for Tag. - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = OptionalNullable.of(tag); - } - - /** - * UnSetter for Tag. - */ - public void unsetTag() { - tag = null; - } - - /** - * Converts this ModifyCallRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ModifyCallRequest [" + "state=" + state + ", redirectUrl=" + redirectUrl - + ", redirectFallbackUrl=" + redirectFallbackUrl + ", redirectMethod=" - + redirectMethod + ", redirectFallbackMethod=" + redirectFallbackMethod - + ", username=" + username + ", password=" + password + ", fallbackUsername=" - + fallbackUsername + ", fallbackPassword=" + fallbackPassword + ", tag=" + tag - + "]"; - } - - /** - * Builds a new {@link ModifyCallRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ModifyCallRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(); - builder.state = internalGetState(); - builder.redirectUrl = internalGetRedirectUrl(); - builder.redirectFallbackUrl = internalGetRedirectFallbackUrl(); - builder.redirectMethod = internalGetRedirectMethod(); - builder.redirectFallbackMethod = internalGetRedirectFallbackMethod(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.fallbackUsername = internalGetFallbackUsername(); - builder.fallbackPassword = internalGetFallbackPassword(); - builder.tag = internalGetTag(); - return builder; - } - - /** - * Class to build instances of {@link ModifyCallRequest}. - */ - public static class Builder { - private OptionalNullable state = OptionalNullable.of(StateEnum.ACTIVE); - private OptionalNullable redirectUrl; - private OptionalNullable redirectFallbackUrl; - private OptionalNullable redirectMethod; - private OptionalNullable redirectFallbackMethod; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable fallbackUsername; - private OptionalNullable fallbackPassword; - private OptionalNullable tag; - - - - /** - * Setter for state. - * @param state StateEnum value for state. - * @return Builder - */ - public Builder state(StateEnum state) { - this.state = OptionalNullable.of(state); - return this; - } - - /** - * UnSetter for state. - * @return Builder - */ - public Builder unsetState() { - state = null; - return this; - } - - /** - * Setter for redirectUrl. - * @param redirectUrl String value for redirectUrl. - * @return Builder - */ - public Builder redirectUrl(String redirectUrl) { - this.redirectUrl = OptionalNullable.of(redirectUrl); - return this; - } - - /** - * UnSetter for redirectUrl. - * @return Builder - */ - public Builder unsetRedirectUrl() { - redirectUrl = null; - return this; - } - - /** - * Setter for redirectFallbackUrl. - * @param redirectFallbackUrl String value for redirectFallbackUrl. - * @return Builder - */ - public Builder redirectFallbackUrl(String redirectFallbackUrl) { - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - return this; - } - - /** - * UnSetter for redirectFallbackUrl. - * @return Builder - */ - public Builder unsetRedirectFallbackUrl() { - redirectFallbackUrl = null; - return this; - } - - /** - * Setter for redirectMethod. - * @param redirectMethod RedirectMethodEnum value for redirectMethod. - * @return Builder - */ - public Builder redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = OptionalNullable.of(redirectMethod); - return this; - } - - /** - * UnSetter for redirectMethod. - * @return Builder - */ - public Builder unsetRedirectMethod() { - redirectMethod = null; - return this; - } - - /** - * Setter for redirectFallbackMethod. - * @param redirectFallbackMethod RedirectFallbackMethodEnum value for - * redirectFallbackMethod. - * @return Builder - */ - public Builder redirectFallbackMethod(RedirectFallbackMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - return this; - } - - /** - * UnSetter for redirectFallbackMethod. - * @return Builder - */ - public Builder unsetRedirectFallbackMethod() { - redirectFallbackMethod = null; - return this; - } - - /** - * Setter for username. - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for fallbackUsername. - * @param fallbackUsername String value for fallbackUsername. - * @return Builder - */ - public Builder fallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - return this; - } - - /** - * UnSetter for fallbackUsername. - * @return Builder - */ - public Builder unsetFallbackUsername() { - fallbackUsername = null; - return this; - } - - /** - * Setter for fallbackPassword. - * @param fallbackPassword String value for fallbackPassword. - * @return Builder - */ - public Builder fallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - return this; - } - - /** - * UnSetter for fallbackPassword. - * @return Builder - */ - public Builder unsetFallbackPassword() { - fallbackPassword = null; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = OptionalNullable.of(tag); - return this; - } - - /** - * UnSetter for tag. - * @return Builder - */ - public Builder unsetTag() { - tag = null; - return this; - } - - /** - * Builds a new {@link ModifyCallRequest} object using the set fields. - * @return {@link ModifyCallRequest} - */ - public ModifyCallRequest build() { - return new ModifyCallRequest(state, redirectUrl, redirectFallbackUrl, redirectMethod, - redirectFallbackMethod, username, password, fallbackUsername, fallbackPassword, - tag); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/ModifyConferenceRequest.java b/src/main/java/com/bandwidth/voice/models/ModifyConferenceRequest.java deleted file mode 100644 index f6fe407d..00000000 --- a/src/main/java/com/bandwidth/voice/models/ModifyConferenceRequest.java +++ /dev/null @@ -1,609 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * This is a model class for ModifyConferenceRequest type. - */ -public class ModifyConferenceRequest { - @JsonInclude(JsonInclude.Include.NON_NULL) - private StatusEnum status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectFallbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable redirectFallbackMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackUsername; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable fallbackPassword; - - /** - * Default constructor. - */ - public ModifyConferenceRequest() { - } - - /** - * Initialization constructor. - * @param status StatusEnum value for status. - * @param redirectUrl String value for redirectUrl. - * @param redirectFallbackUrl String value for redirectFallbackUrl. - * @param redirectMethod RedirectMethodEnum value for redirectMethod. - * @param redirectFallbackMethod RedirectFallbackMethodEnum value for redirectFallbackMethod. - * @param username String value for username. - * @param password String value for password. - * @param fallbackUsername String value for fallbackUsername. - * @param fallbackPassword String value for fallbackPassword. - */ - public ModifyConferenceRequest( - StatusEnum status, - String redirectUrl, - String redirectFallbackUrl, - RedirectMethodEnum redirectMethod, - RedirectFallbackMethodEnum redirectFallbackMethod, - String username, - String password, - String fallbackUsername, - String fallbackPassword) { - this.status = status; - this.redirectUrl = OptionalNullable.of(redirectUrl); - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - this.redirectMethod = OptionalNullable.of(redirectMethod); - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * Internal initialization constructor. - */ - protected ModifyConferenceRequest(StatusEnum status, OptionalNullable redirectUrl, - OptionalNullable redirectFallbackUrl, - OptionalNullable redirectMethod, - OptionalNullable redirectFallbackMethod, - OptionalNullable username, OptionalNullable password, - OptionalNullable fallbackUsername, - OptionalNullable fallbackPassword) { - this.status = status; - this.redirectUrl = redirectUrl; - this.redirectFallbackUrl = redirectFallbackUrl; - this.redirectMethod = redirectMethod; - this.redirectFallbackMethod = redirectFallbackMethod; - this.username = username; - this.password = password; - this.fallbackUsername = fallbackUsername; - this.fallbackPassword = fallbackPassword; - } - - /** - * Getter for Status. - * @return Returns the StatusEnum - */ - @JsonGetter("status") - public StatusEnum getStatus() { - return status; - } - - /** - * Setter for Status. - * @param status Value for StatusEnum - */ - @JsonSetter("status") - public void setStatus(StatusEnum status) { - this.status = status; - } - - /** - * Internal Getter for RedirectUrl. - * @return Returns the Internal String - */ - @JsonGetter("redirectUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectUrl() { - return this.redirectUrl; - } - - /** - * Getter for RedirectUrl. - * @return Returns the String - */ - public String getRedirectUrl() { - return OptionalNullable.getFrom(redirectUrl); - } - - /** - * Setter for RedirectUrl. - * @param redirectUrl Value for String - */ - @JsonSetter("redirectUrl") - public void setRedirectUrl(String redirectUrl) { - this.redirectUrl = OptionalNullable.of(redirectUrl); - } - - /** - * UnSetter for RedirectUrl. - */ - public void unsetRedirectUrl() { - redirectUrl = null; - } - - /** - * Internal Getter for RedirectFallbackUrl. - * @return Returns the Internal String - */ - @JsonGetter("redirectFallbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectFallbackUrl() { - return this.redirectFallbackUrl; - } - - /** - * Getter for RedirectFallbackUrl. - * @return Returns the String - */ - public String getRedirectFallbackUrl() { - return OptionalNullable.getFrom(redirectFallbackUrl); - } - - /** - * Setter for RedirectFallbackUrl. - * @param redirectFallbackUrl Value for String - */ - @JsonSetter("redirectFallbackUrl") - public void setRedirectFallbackUrl(String redirectFallbackUrl) { - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - } - - /** - * UnSetter for RedirectFallbackUrl. - */ - public void unsetRedirectFallbackUrl() { - redirectFallbackUrl = null; - } - - /** - * Internal Getter for RedirectMethod. - * @return Returns the Internal RedirectMethodEnum - */ - @JsonGetter("redirectMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectMethod() { - return this.redirectMethod; - } - - /** - * Getter for RedirectMethod. - * @return Returns the RedirectMethodEnum - */ - public RedirectMethodEnum getRedirectMethod() { - return OptionalNullable.getFrom(redirectMethod); - } - - /** - * Setter for RedirectMethod. - * @param redirectMethod Value for RedirectMethodEnum - */ - @JsonSetter("redirectMethod") - public void setRedirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = OptionalNullable.of(redirectMethod); - } - - /** - * UnSetter for RedirectMethod. - */ - public void unsetRedirectMethod() { - redirectMethod = null; - } - - /** - * Internal Getter for RedirectFallbackMethod. - * @return Returns the Internal RedirectFallbackMethodEnum - */ - @JsonGetter("redirectFallbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetRedirectFallbackMethod() { - return this.redirectFallbackMethod; - } - - /** - * Getter for RedirectFallbackMethod. - * @return Returns the RedirectFallbackMethodEnum - */ - public RedirectFallbackMethodEnum getRedirectFallbackMethod() { - return OptionalNullable.getFrom(redirectFallbackMethod); - } - - /** - * Setter for RedirectFallbackMethod. - * @param redirectFallbackMethod Value for RedirectFallbackMethodEnum - */ - @JsonSetter("redirectFallbackMethod") - public void setRedirectFallbackMethod(RedirectFallbackMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - } - - /** - * UnSetter for RedirectFallbackMethod. - */ - public void unsetRedirectFallbackMethod() { - redirectFallbackMethod = null; - } - - /** - * Internal Getter for Username. - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for FallbackUsername. - * @return Returns the Internal String - */ - @JsonGetter("fallbackUsername") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackUsername() { - return this.fallbackUsername; - } - - /** - * Getter for FallbackUsername. - * @return Returns the String - */ - public String getFallbackUsername() { - return OptionalNullable.getFrom(fallbackUsername); - } - - /** - * Setter for FallbackUsername. - * @param fallbackUsername Value for String - */ - @JsonSetter("fallbackUsername") - public void setFallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - } - - /** - * UnSetter for FallbackUsername. - */ - public void unsetFallbackUsername() { - fallbackUsername = null; - } - - /** - * Internal Getter for FallbackPassword. - * @return Returns the Internal String - */ - @JsonGetter("fallbackPassword") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetFallbackPassword() { - return this.fallbackPassword; - } - - /** - * Getter for FallbackPassword. - * @return Returns the String - */ - public String getFallbackPassword() { - return OptionalNullable.getFrom(fallbackPassword); - } - - /** - * Setter for FallbackPassword. - * @param fallbackPassword Value for String - */ - @JsonSetter("fallbackPassword") - public void setFallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - } - - /** - * UnSetter for FallbackPassword. - */ - public void unsetFallbackPassword() { - fallbackPassword = null; - } - - /** - * Converts this ModifyConferenceRequest into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ModifyConferenceRequest [" + "status=" + status + ", redirectUrl=" + redirectUrl - + ", redirectFallbackUrl=" + redirectFallbackUrl + ", redirectMethod=" - + redirectMethod + ", redirectFallbackMethod=" + redirectFallbackMethod - + ", username=" + username + ", password=" + password + ", fallbackUsername=" - + fallbackUsername + ", fallbackPassword=" + fallbackPassword + "]"; - } - - /** - * Builds a new {@link ModifyConferenceRequest.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ModifyConferenceRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .status(getStatus()); - builder.redirectUrl = internalGetRedirectUrl(); - builder.redirectFallbackUrl = internalGetRedirectFallbackUrl(); - builder.redirectMethod = internalGetRedirectMethod(); - builder.redirectFallbackMethod = internalGetRedirectFallbackMethod(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.fallbackUsername = internalGetFallbackUsername(); - builder.fallbackPassword = internalGetFallbackPassword(); - return builder; - } - - /** - * Class to build instances of {@link ModifyConferenceRequest}. - */ - public static class Builder { - private StatusEnum status; - private OptionalNullable redirectUrl; - private OptionalNullable redirectFallbackUrl; - private OptionalNullable redirectMethod; - private OptionalNullable redirectFallbackMethod; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable fallbackUsername; - private OptionalNullable fallbackPassword; - - - - /** - * Setter for status. - * @param status StatusEnum value for status. - * @return Builder - */ - public Builder status(StatusEnum status) { - this.status = status; - return this; - } - - /** - * Setter for redirectUrl. - * @param redirectUrl String value for redirectUrl. - * @return Builder - */ - public Builder redirectUrl(String redirectUrl) { - this.redirectUrl = OptionalNullable.of(redirectUrl); - return this; - } - - /** - * UnSetter for redirectUrl. - * @return Builder - */ - public Builder unsetRedirectUrl() { - redirectUrl = null; - return this; - } - - /** - * Setter for redirectFallbackUrl. - * @param redirectFallbackUrl String value for redirectFallbackUrl. - * @return Builder - */ - public Builder redirectFallbackUrl(String redirectFallbackUrl) { - this.redirectFallbackUrl = OptionalNullable.of(redirectFallbackUrl); - return this; - } - - /** - * UnSetter for redirectFallbackUrl. - * @return Builder - */ - public Builder unsetRedirectFallbackUrl() { - redirectFallbackUrl = null; - return this; - } - - /** - * Setter for redirectMethod. - * @param redirectMethod RedirectMethodEnum value for redirectMethod. - * @return Builder - */ - public Builder redirectMethod(RedirectMethodEnum redirectMethod) { - this.redirectMethod = OptionalNullable.of(redirectMethod); - return this; - } - - /** - * UnSetter for redirectMethod. - * @return Builder - */ - public Builder unsetRedirectMethod() { - redirectMethod = null; - return this; - } - - /** - * Setter for redirectFallbackMethod. - * @param redirectFallbackMethod RedirectFallbackMethodEnum value for - * redirectFallbackMethod. - * @return Builder - */ - public Builder redirectFallbackMethod(RedirectFallbackMethodEnum redirectFallbackMethod) { - this.redirectFallbackMethod = OptionalNullable.of(redirectFallbackMethod); - return this; - } - - /** - * UnSetter for redirectFallbackMethod. - * @return Builder - */ - public Builder unsetRedirectFallbackMethod() { - redirectFallbackMethod = null; - return this; - } - - /** - * Setter for username. - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for fallbackUsername. - * @param fallbackUsername String value for fallbackUsername. - * @return Builder - */ - public Builder fallbackUsername(String fallbackUsername) { - this.fallbackUsername = OptionalNullable.of(fallbackUsername); - return this; - } - - /** - * UnSetter for fallbackUsername. - * @return Builder - */ - public Builder unsetFallbackUsername() { - fallbackUsername = null; - return this; - } - - /** - * Setter for fallbackPassword. - * @param fallbackPassword String value for fallbackPassword. - * @return Builder - */ - public Builder fallbackPassword(String fallbackPassword) { - this.fallbackPassword = OptionalNullable.of(fallbackPassword); - return this; - } - - /** - * UnSetter for fallbackPassword. - * @return Builder - */ - public Builder unsetFallbackPassword() { - fallbackPassword = null; - return this; - } - - /** - * Builds a new {@link ModifyConferenceRequest} object using the set fields. - * @return {@link ModifyConferenceRequest} - */ - public ModifyConferenceRequest build() { - return new ModifyConferenceRequest(status, redirectUrl, redirectFallbackUrl, - redirectMethod, redirectFallbackMethod, username, password, fallbackUsername, - fallbackPassword); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/RedirectFallbackMethodEnum.java b/src/main/java/com/bandwidth/voice/models/RedirectFallbackMethodEnum.java deleted file mode 100644 index 14f49127..00000000 --- a/src/main/java/com/bandwidth/voice/models/RedirectFallbackMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * RedirectFallbackMethodEnum to be used. - */ -public enum RedirectFallbackMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static RedirectFallbackMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of RedirectFallbackMethodEnum values to list of string values. - * @param toConvert The list of RedirectFallbackMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (RedirectFallbackMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/RedirectMethodEnum.java b/src/main/java/com/bandwidth/voice/models/RedirectMethodEnum.java deleted file mode 100644 index 0b9edc3f..00000000 --- a/src/main/java/com/bandwidth/voice/models/RedirectMethodEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * RedirectMethodEnum to be used. - */ -public enum RedirectMethodEnum { - POST, - - GET; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - POST.value = "POST"; - GET.value = "GET"; - - valueMap.put("POST", POST); - valueMap.put("GET", GET); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static RedirectMethodEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of RedirectMethodEnum values to list of string values. - * @param toConvert The list of RedirectMethodEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (RedirectMethodEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/State1Enum.java b/src/main/java/com/bandwidth/voice/models/State1Enum.java deleted file mode 100644 index 1f888122..00000000 --- a/src/main/java/com/bandwidth/voice/models/State1Enum.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * State1Enum to be used. - */ -public enum State1Enum { - NOT_RECORDING, - - PAUSED, - - RECORDING; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - NOT_RECORDING.value = "NOT_RECORDING"; - PAUSED.value = "PAUSED"; - RECORDING.value = "RECORDING"; - - valueMap.put("NOT_RECORDING", NOT_RECORDING); - valueMap.put("PAUSED", PAUSED); - valueMap.put("RECORDING", RECORDING); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static State1Enum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of State1Enum values to list of string values. - * @param toConvert The list of State1Enum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (State1Enum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/StateEnum.java b/src/main/java/com/bandwidth/voice/models/StateEnum.java deleted file mode 100644 index a89552a5..00000000 --- a/src/main/java/com/bandwidth/voice/models/StateEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * StateEnum to be used. - */ -public enum StateEnum { - ACTIVE, - - COMPLETED; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - ACTIVE.value = "active"; - COMPLETED.value = "completed"; - - valueMap.put("active", ACTIVE); - valueMap.put("completed", COMPLETED); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static StateEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of StateEnum values to list of string values. - * @param toConvert The list of StateEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (StateEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/StatusEnum.java b/src/main/java/com/bandwidth/voice/models/StatusEnum.java deleted file mode 100644 index 4a369188..00000000 --- a/src/main/java/com/bandwidth/voice/models/StatusEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * StatusEnum to be used. - */ -public enum StatusEnum { - ACTIVE, - - COMPLETED; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - ACTIVE.value = "active"; - COMPLETED.value = "completed"; - - valueMap.put("active", ACTIVE); - valueMap.put("completed", COMPLETED); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static StatusEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of StatusEnum values to list of string values. - * @param toConvert The list of StatusEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (StatusEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/voice/models/TranscribeRecordingRequest.java b/src/main/java/com/bandwidth/voice/models/TranscribeRecordingRequest.java deleted file mode 100644 index 0eae0884..00000000 --- a/src/main/java/com/bandwidth/voice/models/TranscribeRecordingRequest.java +++ /dev/null @@ -1,514 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -/** - * This is a model class for TranscribeRecordingRequest type. - */ -public class TranscribeRecordingRequest { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String callbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackMethod; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable username; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable password; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackTimeout; - private OptionalNullable detectLanguage; - - /** - * Default constructor. - */ - public TranscribeRecordingRequest() { - } - - /** - * Initialization constructor. - * - * @param callbackUrl String value for callbackUrl. - * @param callbackMethod CallbackMethodEnum value for callbackMethod. - * @param username String value for username. - * @param password String value for password. - * @param tag String value for tag. - * @param callbackTimeout Double value for callbackTimeout. - * @param detectLanguage Boolean value for detectLanguage - */ - public TranscribeRecordingRequest( - String callbackUrl, - CallbackMethodEnum callbackMethod, - String username, - String password, - String tag, - Double callbackTimeout, - Boolean detectLanguage) { - this.callbackUrl = callbackUrl; - this.callbackMethod = OptionalNullable.of(callbackMethod); - this.username = OptionalNullable.of(username); - this.password = OptionalNullable.of(password); - this.tag = OptionalNullable.of(tag); - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - this.detectLanguage = OptionalNullable.of(detectLanguage); - } - - /** - * Internal initialization constructor. - */ - protected TranscribeRecordingRequest(String callbackUrl, - OptionalNullable callbackMethod, OptionalNullable username, - OptionalNullable password, OptionalNullable tag, - OptionalNullable callbackTimeout, OptionalNullable detectLanguage) { - this.callbackUrl = callbackUrl; - this.callbackMethod = callbackMethod; - this.username = username; - this.password = password; - this.tag = tag; - this.callbackTimeout = callbackTimeout; - this.detectLanguage = detectLanguage; - } - - /** - * Getter for CallbackUrl. - * - * @return Returns the String - */ - @JsonGetter("callbackUrl") - public String getCallbackUrl() { - return callbackUrl; - } - - /** - * Setter for CallbackUrl. - * - * @param callbackUrl Value for String - */ - @JsonSetter("callbackUrl") - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - /** - * Internal Getter for CallbackMethod. - * - * @return Returns the Internal CallbackMethodEnum - */ - @JsonGetter("callbackMethod") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackMethod() { - return this.callbackMethod; - } - - /** - * Getter for CallbackMethod. - * - * @return Returns the CallbackMethodEnum - */ - public CallbackMethodEnum getCallbackMethod() { - return OptionalNullable.getFrom(callbackMethod); - } - - /** - * Setter for CallbackMethod. - * - * @param callbackMethod Value for CallbackMethodEnum - */ - @JsonSetter("callbackMethod") - public void setCallbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = OptionalNullable.of(callbackMethod); - } - - /** - * UnSetter for CallbackMethod. - */ - public void unsetCallbackMethod() { - callbackMethod = null; - } - - /** - * Internal Getter for Username. - * - * @return Returns the Internal String - */ - @JsonGetter("username") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetUsername() { - return this.username; - } - - /** - * Getter for Username. - * - * @return Returns the String - */ - public String getUsername() { - return OptionalNullable.getFrom(username); - } - - /** - * Setter for Username. - * - * @param username Value for String - */ - @JsonSetter("username") - public void setUsername(String username) { - this.username = OptionalNullable.of(username); - } - - /** - * UnSetter for Username. - */ - public void unsetUsername() { - username = null; - } - - /** - * Internal Getter for Password. - * - * @return Returns the Internal String - */ - @JsonGetter("password") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPassword() { - return this.password; - } - - /** - * Getter for Password. - * - * @return Returns the String - */ - public String getPassword() { - return OptionalNullable.getFrom(password); - } - - /** - * Setter for Password. - * - * @param password Value for String - */ - @JsonSetter("password") - public void setPassword(String password) { - this.password = OptionalNullable.of(password); - } - - /** - * UnSetter for Password. - */ - public void unsetPassword() { - password = null; - } - - /** - * Internal Getter for Tag. - * - * @return Returns the Internal String - */ - @JsonGetter("tag") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetTag() { - return this.tag; - } - - /** - * Getter for Tag. - * - * @return Returns the String - */ - public String getTag() { - return OptionalNullable.getFrom(tag); - } - - /** - * Setter for Tag. - * - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = OptionalNullable.of(tag); - } - - /** - * UnSetter for Tag. - */ - public void unsetTag() { - tag = null; - } - - /** - * Internal Getter for CallbackTimeout. - * - * @return Returns the Internal Double - */ - @JsonGetter("callbackTimeout") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackTimeout() { - return this.callbackTimeout; - } - - /** - * Getter for CallbackTimeout. - * - * @return Returns the Double - */ - public Double getCallbackTimeout() { - return OptionalNullable.getFrom(callbackTimeout); - } - - /** - * Setter for CallbackTimeout. - * - * @param callbackTimeout Value for Double - */ - @JsonSetter("callbackTimeout") - public void setCallbackTimeout(Double callbackTimeout) { - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - } - - /** - * UnSetter for CallbackTimeout. - */ - public void unsetCallbackTimeout() { - callbackTimeout = null; - } - - /** - * Internal Getter for DetectLanguage. - * - * @return Returns the Internal Boolean - */ - @JsonGetter("detectLanguage") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetDetectLanguage() { - return this.detectLanguage; - } - - /** - * Getter for DetectLanguage. - * - * @return Returns the Boolean - */ - public Boolean getDetectLanguage() { - return OptionalNullable.getFrom(detectLanguage); - } - - /** - * Setter for DetectLanguage. - * - * @param detectLanguage Value for Boolean - */ - @JsonSetter("detectLanguage") - public void setDetectLanguage(Boolean detectLanguage) { - this.detectLanguage = OptionalNullable.of(detectLanguage); - } - - /** - * UnSetter for DetectLanguage. - */ - public void unsetDetectLanguage() { - detectLanguage = null; - } - - /** - * Converts this TranscribeRecordingRequest into string format. - * - * @return String representation of this class - */ - @Override - public String toString() { - return "TranscribeRecordingRequest [" + "callbackUrl=" + callbackUrl + ", callbackMethod=" - + callbackMethod + ", username=" + username + ", password=" + password + ", tag=" - + tag + ", callbackTimeout=" + callbackTimeout + ", detectLanguage=" + detectLanguage + "]"; - } - - /** - * Builds a new {@link TranscribeRecordingRequest.Builder} object. - * Creates the instance with the state of the current model. - * - * @return a new {@link TranscribeRecordingRequest.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .callbackUrl(getCallbackUrl()); - builder.callbackMethod = internalGetCallbackMethod(); - builder.username = internalGetUsername(); - builder.password = internalGetPassword(); - builder.tag = internalGetTag(); - builder.callbackTimeout = internalGetCallbackTimeout(); - builder.detectLanguage = internalGetDetectLanguage(); - return builder; - } - - /** - * Class to build instances of {@link TranscribeRecordingRequest}. - */ - public static class Builder { - private String callbackUrl; - private OptionalNullable callbackMethod; - private OptionalNullable username; - private OptionalNullable password; - private OptionalNullable tag; - private OptionalNullable callbackTimeout; - private OptionalNullable detectLanguage; - - /** - * Setter for callbackUrl. - * - * @param callbackUrl String value for callbackUrl. - * @return Builder - */ - public Builder callbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - return this; - } - - /** - * Setter for callbackMethod. - * - * @param callbackMethod CallbackMethodEnum value for callbackMethod. - * @return Builder - */ - public Builder callbackMethod(CallbackMethodEnum callbackMethod) { - this.callbackMethod = OptionalNullable.of(callbackMethod); - return this; - } - - /** - * UnSetter for callbackMethod. - * - * @return Builder - */ - public Builder unsetCallbackMethod() { - callbackMethod = null; - return this; - } - - /** - * Setter for username. - * - * @param username String value for username. - * @return Builder - */ - public Builder username(String username) { - this.username = OptionalNullable.of(username); - return this; - } - - /** - * UnSetter for username. - * - * @return Builder - */ - public Builder unsetUsername() { - username = null; - return this; - } - - /** - * Setter for password. - * - * @param password String value for password. - * @return Builder - */ - public Builder password(String password) { - this.password = OptionalNullable.of(password); - return this; - } - - /** - * UnSetter for password. - * - * @return Builder - */ - public Builder unsetPassword() { - password = null; - return this; - } - - /** - * Setter for tag. - * - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = OptionalNullable.of(tag); - return this; - } - - /** - * UnSetter for tag. - * - * @return Builder - */ - public Builder unsetTag() { - tag = null; - return this; - } - - /** - * Setter for callbackTimeout. - * - * @param callbackTimeout Double value for callbackTimeout. - * @return Builder - */ - public Builder callbackTimeout(Double callbackTimeout) { - this.callbackTimeout = OptionalNullable.of(callbackTimeout); - return this; - } - - /** - * UnSetter for callbackTimeout. - * - * @return Builder - */ - public Builder unsetCallbackTimeout() { - callbackTimeout = null; - return this; - } - - /** - * Setter for detectLanguage. - * - * @param detectLanguage Boolean value for detectLanguage. - * @return Builder - */ - public Builder detectLanguage(Boolean detectLanguage) { - this.detectLanguage = OptionalNullable.of(detectLanguage); - return this; - } - - /** - * UnSetter for detectLanguage. - * - * @return Builder - */ - public Builder unsetDetectLanguage() { - detectLanguage = null; - return this; - } - - /** - * Builds a new {@link TranscribeRecordingRequest} object using the set fields. - * - * @return {@link TranscribeRecordingRequest} - */ - public TranscribeRecordingRequest build() { - return new TranscribeRecordingRequest(callbackUrl, callbackMethod, username, password, - tag, callbackTimeout, detectLanguage); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/Transcript.java b/src/main/java/com/bandwidth/voice/models/Transcript.java deleted file mode 100644 index 3bf38c64..00000000 --- a/src/main/java/com/bandwidth/voice/models/Transcript.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Transcript type. - */ -public class Transcript { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String text; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Double confidence; - - /** - * Default constructor. - */ - public Transcript() { - } - - /** - * Initialization constructor. - * @param text String value for text. - * @param confidence Double value for confidence. - */ - public Transcript( - String text, - Double confidence) { - this.text = text; - this.confidence = confidence; - } - - /** - * Getter for Text. - * @return Returns the String - */ - @JsonGetter("text") - public String getText() { - return text; - } - - /** - * Setter for Text. - * @param text Value for String - */ - @JsonSetter("text") - public void setText(String text) { - this.text = text; - } - - /** - * Getter for Confidence. - * @return Returns the Double - */ - @JsonGetter("confidence") - public Double getConfidence() { - return confidence; - } - - /** - * Setter for Confidence. - * @param confidence Value for Double - */ - @JsonSetter("confidence") - public void setConfidence(Double confidence) { - this.confidence = confidence; - } - - /** - * Converts this Transcript into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Transcript [" + "text=" + text + ", confidence=" + confidence + "]"; - } - - /** - * Builds a new {@link Transcript.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Transcript.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .text(getText()) - .confidence(getConfidence()); - return builder; - } - - /** - * Class to build instances of {@link Transcript}. - */ - public static class Builder { - private String text; - private Double confidence; - - - - /** - * Setter for text. - * @param text String value for text. - * @return Builder - */ - public Builder text(String text) { - this.text = text; - return this; - } - - /** - * Setter for confidence. - * @param confidence Double value for confidence. - * @return Builder - */ - public Builder confidence(Double confidence) { - this.confidence = confidence; - return this; - } - - /** - * Builds a new {@link Transcript} object using the set fields. - * @return {@link Transcript} - */ - public Transcript build() { - return new Transcript(text, confidence); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/Transcription.java b/src/main/java/com/bandwidth/voice/models/Transcription.java deleted file mode 100644 index a040b290..00000000 --- a/src/main/java/com/bandwidth/voice/models/Transcription.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Transcription type. - */ -public class Transcription { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String url; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String completedTime; - - /** - * Default constructor. - */ - public Transcription() { - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param url String value for url. - * @param status String value for status. - * @param completedTime String value for completedTime. - */ - public Transcription( - String id, - String url, - String status, - String completedTime) { - this.id = id; - this.url = url; - this.status = status; - this.completedTime = completedTime; - } - - /** - * Getter for Id. - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Getter for Url. - * @return Returns the String - */ - @JsonGetter("url") - public String getUrl() { - return url; - } - - /** - * Setter for Url. - * @param url Value for String - */ - @JsonSetter("url") - public void setUrl(String url) { - this.url = url; - } - - /** - * Getter for Status. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for CompletedTime. - * @return Returns the String - */ - @JsonGetter("completedTime") - public String getCompletedTime() { - return completedTime; - } - - /** - * Setter for CompletedTime. - * @param completedTime Value for String - */ - @JsonSetter("completedTime") - public void setCompletedTime(String completedTime) { - this.completedTime = completedTime; - } - - /** - * Converts this Transcription into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Transcription [" + "id=" + id + ", url=" + url + ", status=" + status - + ", completedTime=" + completedTime + "]"; - } - - /** - * Builds a new {@link Transcription.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Transcription.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .url(getUrl()) - .status(getStatus()) - .completedTime(getCompletedTime()); - return builder; - } - - /** - * Class to build instances of {@link Transcription}. - */ - public static class Builder { - private String id; - private String url; - private String status; - private String completedTime; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for url. - * @param url String value for url. - * @return Builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for completedTime. - * @param completedTime String value for completedTime. - * @return Builder - */ - public Builder completedTime(String completedTime) { - this.completedTime = completedTime; - return this; - } - - /** - * Builds a new {@link Transcription} object using the set fields. - * @return {@link Transcription} - */ - public Transcription build() { - return new Transcription(id, url, status, completedTime); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/TranscriptionMetadata.java b/src/main/java/com/bandwidth/voice/models/TranscriptionMetadata.java deleted file mode 100644 index aa7665af..00000000 --- a/src/main/java/com/bandwidth/voice/models/TranscriptionMetadata.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for TranscriptionMetadata type. - */ -public class TranscriptionMetadata { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String status; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String completedTime; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String url; - - /** - * Default constructor. - */ - public TranscriptionMetadata() { - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param status String value for status. - * @param completedTime String value for completedTime. - * @param url String value for url. - */ - public TranscriptionMetadata( - String id, - String status, - String completedTime, - String url) { - this.id = id; - this.status = status; - this.completedTime = completedTime; - this.url = url; - } - - /** - * Getter for Id. - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Getter for Status. - * The current status of the transcription. Current values are 'none', 'processing', - * 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional - * states may be added in the future, so your application must be tolerant of unknown values. - * @return Returns the String - */ - @JsonGetter("status") - public String getStatus() { - return status; - } - - /** - * Setter for Status. - * The current status of the transcription. Current values are 'none', 'processing', - * 'available', 'error', 'timeout', 'file-size-too-big', and 'file-size-too-small'. Additional - * states may be added in the future, so your application must be tolerant of unknown values. - * @param status Value for String - */ - @JsonSetter("status") - public void setStatus(String status) { - this.status = status; - } - - /** - * Getter for CompletedTime. - * @return Returns the String - */ - @JsonGetter("completedTime") - public String getCompletedTime() { - return completedTime; - } - - /** - * Setter for CompletedTime. - * @param completedTime Value for String - */ - @JsonSetter("completedTime") - public void setCompletedTime(String completedTime) { - this.completedTime = completedTime; - } - - /** - * Getter for Url. - * @return Returns the String - */ - @JsonGetter("url") - public String getUrl() { - return url; - } - - /** - * Setter for Url. - * @param url Value for String - */ - @JsonSetter("url") - public void setUrl(String url) { - this.url = url; - } - - /** - * Converts this TranscriptionMetadata into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TranscriptionMetadata [" + "id=" + id + ", status=" + status + ", completedTime=" - + completedTime + ", url=" + url + "]"; - } - - /** - * Builds a new {@link TranscriptionMetadata.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TranscriptionMetadata.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .status(getStatus()) - .completedTime(getCompletedTime()) - .url(getUrl()); - return builder; - } - - /** - * Class to build instances of {@link TranscriptionMetadata}. - */ - public static class Builder { - private String id; - private String status; - private String completedTime; - private String url; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for status. - * @param status String value for status. - * @return Builder - */ - public Builder status(String status) { - this.status = status; - return this; - } - - /** - * Setter for completedTime. - * @param completedTime String value for completedTime. - * @return Builder - */ - public Builder completedTime(String completedTime) { - this.completedTime = completedTime; - return this; - } - - /** - * Setter for url. - * @param url String value for url. - * @return Builder - */ - public Builder url(String url) { - this.url = url; - return this; - } - - /** - * Builds a new {@link TranscriptionMetadata} object using the set fields. - * @return {@link TranscriptionMetadata} - */ - public TranscriptionMetadata build() { - return new TranscriptionMetadata(id, status, completedTime, url); - } - } -} diff --git a/src/main/java/com/bandwidth/voice/models/TranscriptionResponse.java b/src/main/java/com/bandwidth/voice/models/TranscriptionResponse.java deleted file mode 100644 index eeabb747..00000000 --- a/src/main/java/com/bandwidth/voice/models/TranscriptionResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.voice.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for TranscriptionResponse type. - */ -public class TranscriptionResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private List transcripts; - - /** - * Default constructor. - */ - public TranscriptionResponse() { - } - - /** - * Initialization constructor. - * @param transcripts List of Transcript value for transcripts. - */ - public TranscriptionResponse( - List transcripts) { - this.transcripts = transcripts; - } - - /** - * Getter for Transcripts. - * @return Returns the List of Transcript - */ - @JsonGetter("transcripts") - public List getTranscripts() { - return transcripts; - } - - /** - * Setter for Transcripts. - * @param transcripts Value for List of Transcript - */ - @JsonSetter("transcripts") - public void setTranscripts(List transcripts) { - this.transcripts = transcripts; - } - - /** - * Converts this TranscriptionResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "TranscriptionResponse [" + "transcripts=" + transcripts + "]"; - } - - /** - * Builds a new {@link TranscriptionResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link TranscriptionResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .transcripts(getTranscripts()); - return builder; - } - - /** - * Class to build instances of {@link TranscriptionResponse}. - */ - public static class Builder { - private List transcripts; - - - - /** - * Setter for transcripts. - * @param transcripts List of Transcript value for transcripts. - * @return Builder - */ - public Builder transcripts(List transcripts) { - this.transcripts = transcripts; - return this; - } - - /** - * Builds a new {@link TranscriptionResponse} object using the set fields. - * @return {@link TranscriptionResponse} - */ - public TranscriptionResponse build() { - return new TranscriptionResponse(transcripts); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/controllers/APIController.java b/src/main/java/com/bandwidth/webrtc/controllers/APIController.java deleted file mode 100644 index b678293b..00000000 --- a/src/main/java/com/bandwidth/webrtc/controllers/APIController.java +++ /dev/null @@ -1,1325 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.controllers; - -import com.bandwidth.ApiHelper; -import com.bandwidth.AuthManager; -import com.bandwidth.Configuration; -import com.bandwidth.Server; -import com.bandwidth.controllers.BaseController; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.Headers; -import com.bandwidth.http.client.HttpCallback; -import com.bandwidth.http.client.HttpClient; -import com.bandwidth.http.client.HttpContext; -import com.bandwidth.http.request.HttpRequest; -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.http.response.HttpResponse; -import com.bandwidth.http.response.HttpStringResponse; -import com.bandwidth.webrtc.exceptions.ErrorException; -import com.bandwidth.webrtc.models.AccountsParticipantsResponse; -import com.bandwidth.webrtc.models.Participant; -import com.bandwidth.webrtc.models.Session; -import com.bandwidth.webrtc.models.Subscriptions; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.io.IOException; -import java.util.AbstractMap.SimpleEntry; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; - -/** - * This class lists all the endpoints of the groups. - */ -public final class APIController extends BaseController { - - /** - * Initializes the controller. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers) { - super(config, httpClient, authManagers); - } - - /** - * Initializes the controller with HTTPCallback. - * @param config Configurations added in client. - * @param httpClient Send HTTP requests and read the responses. - * @param authManagers Apply authorization to requests. - * @param httpCallback Callback to be called before and after the HTTP call. - */ - public APIController(Configuration config, HttpClient httpClient, - Map authManagers, HttpCallback httpCallback) { - super(config, httpClient, authManagers, httpCallback); - } - - /** - * Create a new participant under this account. Participants are idempotent, so relevant - * parameters must be set in this function if desired. - * @param accountId Required parameter: Account ID - * @param body Optional parameter: Participant parameters - * @return Returns the AccountsParticipantsResponse wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createParticipant( - final String accountId, - final Participant body) throws ApiException, IOException { - HttpRequest request = buildCreateParticipantRequest(accountId, body); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateParticipantResponse(context); - } - - /** - * Create a new participant under this account. Participants are idempotent, so relevant - * parameters must be set in this function if desired. - * @param accountId Required parameter: Account ID - * @param body Optional parameter: Participant parameters - * @return Returns the AccountsParticipantsResponse wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createParticipantAsync( - final String accountId, - final Participant body) { - return makeHttpCallAsync(() -> buildCreateParticipantRequest(accountId, body), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateParticipantResponse(context)); - } - - /** - * Builds the HttpRequest object for createParticipant. - */ - private HttpRequest buildCreateParticipantRequest( - final String accountId, - final Participant body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/participants"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createParticipant. - * @return An object of type AccountsParticipantsResponse - */ - private ApiResponse handleCreateParticipantResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiException("Bad Request", context); - } - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - AccountsParticipantsResponse result = ApiHelper.deserialize(responseBody, - AccountsParticipantsResponse.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Get participant by ID. - * @param accountId Required parameter: Account ID - * @param participantId Required parameter: Participant ID - * @return Returns the Participant wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getParticipant( - final String accountId, - final String participantId) throws ApiException, IOException { - HttpRequest request = buildGetParticipantRequest(accountId, participantId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetParticipantResponse(context); - } - - /** - * Get participant by ID. - * @param accountId Required parameter: Account ID - * @param participantId Required parameter: Participant ID - * @return Returns the Participant wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getParticipantAsync( - final String accountId, - final String participantId) { - return makeHttpCallAsync(() -> buildGetParticipantRequest(accountId, participantId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetParticipantResponse(context)); - } - - /** - * Builds the HttpRequest object for getParticipant. - */ - private HttpRequest buildGetParticipantRequest( - final String accountId, - final String participantId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/participants/{participantId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getParticipant. - * @return An object of type Participant - */ - private ApiResponse handleGetParticipantResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - Participant result = ApiHelper.deserialize(responseBody, - Participant.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Delete participant by ID. - * @param accountId Required parameter: Account ID - * @param participantId Required parameter: Example: - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteParticipant( - final String accountId, - final String participantId) throws ApiException, IOException { - HttpRequest request = buildDeleteParticipantRequest(accountId, participantId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteParticipantResponse(context); - } - - /** - * Delete participant by ID. - * @param accountId Required parameter: Account ID - * @param participantId Required parameter: Example: - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteParticipantAsync( - final String accountId, - final String participantId) { - return makeHttpCallAsync(() -> buildDeleteParticipantRequest(accountId, participantId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteParticipantResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteParticipant. - */ - private HttpRequest buildDeleteParticipantRequest( - final String accountId, - final String participantId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/participants/{participantId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteParticipant. - * @return An object of type void - */ - private ApiResponse handleDeleteParticipantResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Create a new session. Sessions are idempotent, so relevant parameters must be set in this - * function if desired. - * @param accountId Required parameter: Account ID - * @param body Optional parameter: Session parameters - * @return Returns the Session wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse createSession( - final String accountId, - final Session body) throws ApiException, IOException { - HttpRequest request = buildCreateSessionRequest(accountId, body); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleCreateSessionResponse(context); - } - - /** - * Create a new session. Sessions are idempotent, so relevant parameters must be set in this - * function if desired. - * @param accountId Required parameter: Account ID - * @param body Optional parameter: Session parameters - * @return Returns the Session wrapped in ApiResponse response from the API call - */ - public CompletableFuture> createSessionAsync( - final String accountId, - final Session body) { - return makeHttpCallAsync(() -> buildCreateSessionRequest(accountId, body), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleCreateSessionResponse(context)); - } - - /** - * Builds the HttpRequest object for createSession. - */ - private HttpRequest buildCreateSessionRequest( - final String accountId, - final Session body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().postBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for createSession. - * @return An object of type Session - */ - private ApiResponse handleCreateSessionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiException("Bad Request", context); - } - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - Session result = ApiHelper.deserialize(responseBody, - Session.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Get session by ID. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @return Returns the Session wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getSession( - final String accountId, - final String sessionId) throws ApiException, IOException { - HttpRequest request = buildGetSessionRequest(accountId, sessionId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetSessionResponse(context); - } - - /** - * Get session by ID. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @return Returns the Session wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getSessionAsync( - final String accountId, - final String sessionId) { - return makeHttpCallAsync(() -> buildGetSessionRequest(accountId, sessionId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetSessionResponse(context)); - } - - /** - * Builds the HttpRequest object for getSession. - */ - private HttpRequest buildGetSessionRequest( - final String accountId, - final String sessionId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getSession. - * @return An object of type Session - */ - private ApiResponse handleGetSessionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - Session result = ApiHelper.deserialize(responseBody, - Session.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Delete session by ID. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse deleteSession( - final String accountId, - final String sessionId) throws ApiException, IOException { - HttpRequest request = buildDeleteSessionRequest(accountId, sessionId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleDeleteSessionResponse(context); - } - - /** - * Delete session by ID. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> deleteSessionAsync( - final String accountId, - final String sessionId) { - return makeHttpCallAsync(() -> buildDeleteSessionRequest(accountId, sessionId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleDeleteSessionResponse(context)); - } - - /** - * Builds the HttpRequest object for deleteSession. - */ - private HttpRequest buildDeleteSessionRequest( - final String accountId, - final String sessionId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for deleteSession. - * @return An object of type void - */ - private ApiResponse handleDeleteSessionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * List participants in a session. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @return Returns the List of Participant wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse> listSessionParticipants( - final String accountId, - final String sessionId) throws ApiException, IOException { - HttpRequest request = buildListSessionParticipantsRequest(accountId, sessionId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleListSessionParticipantsResponse(context); - } - - /** - * List participants in a session. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @return Returns the List of Participant wrapped in ApiResponse response from the API call - */ - public CompletableFuture>> listSessionParticipantsAsync( - final String accountId, - final String sessionId) { - return makeHttpCallAsync(() -> buildListSessionParticipantsRequest(accountId, sessionId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleListSessionParticipantsResponse(context)); - } - - /** - * Builds the HttpRequest object for listSessionParticipants. - */ - private HttpRequest buildListSessionParticipantsRequest( - final String accountId, - final String sessionId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}/participants"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for listSessionParticipants. - * @return An object of type List of Participant - */ - private ApiResponse> handleListSessionParticipantsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - List result = ApiHelper.deserializeArray(responseBody, - Participant[].class); - return new ApiResponse>(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Add a participant to a session. Subscriptions can optionally be provided as part of this - * call. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @param body Optional parameter: Subscriptions the participant should be created with - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse addParticipantToSession( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) throws ApiException, IOException { - HttpRequest request = buildAddParticipantToSessionRequest(accountId, sessionId, - participantId, body); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleAddParticipantToSessionResponse(context); - } - - /** - * Add a participant to a session. Subscriptions can optionally be provided as part of this - * call. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @param body Optional parameter: Subscriptions the participant should be created with - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> addParticipantToSessionAsync( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) { - return makeHttpCallAsync(() -> buildAddParticipantToSessionRequest(accountId, sessionId, - participantId, body), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleAddParticipantToSessionResponse(context)); - } - - /** - * Builds the HttpRequest object for addParticipantToSession. - */ - private HttpRequest buildAddParticipantToSessionRequest( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for addParticipantToSession. - * @return An object of type void - */ - private ApiResponse handleAddParticipantToSessionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Remove a participant from a session. This will automatically remove any subscriptions the - * participant has associated with this session. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse removeParticipantFromSession( - final String accountId, - final String sessionId, - final String participantId) throws ApiException, IOException { - HttpRequest request = buildRemoveParticipantFromSessionRequest(accountId, sessionId, - participantId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleRemoveParticipantFromSessionResponse(context); - } - - /** - * Remove a participant from a session. This will automatically remove any subscriptions the - * participant has associated with this session. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> removeParticipantFromSessionAsync( - final String accountId, - final String sessionId, - final String participantId) { - return makeHttpCallAsync(() -> buildRemoveParticipantFromSessionRequest(accountId, - sessionId, participantId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleRemoveParticipantFromSessionResponse(context)); - } - - /** - * Builds the HttpRequest object for removeParticipantFromSession. - */ - private HttpRequest buildRemoveParticipantFromSessionRequest( - final String accountId, - final String sessionId, - final String participantId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().delete(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for removeParticipantFromSession. - * @return An object of type void - */ - private ApiResponse handleRemoveParticipantFromSessionResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - - /** - * Get a participant's subscriptions. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @return Returns the Subscriptions wrapped in ApiResponse response from the API call - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse getParticipantSubscriptions( - final String accountId, - final String sessionId, - final String participantId) throws ApiException, IOException { - HttpRequest request = buildGetParticipantSubscriptionsRequest(accountId, sessionId, - participantId); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleGetParticipantSubscriptionsResponse(context); - } - - /** - * Get a participant's subscriptions. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @return Returns the Subscriptions wrapped in ApiResponse response from the API call - */ - public CompletableFuture> getParticipantSubscriptionsAsync( - final String accountId, - final String sessionId, - final String participantId) { - return makeHttpCallAsync(() -> buildGetParticipantSubscriptionsRequest(accountId, sessionId, - participantId), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleGetParticipantSubscriptionsResponse(context)); - } - - /** - * Builds the HttpRequest object for getParticipantSubscriptions. - */ - private HttpRequest buildGetParticipantSubscriptionsRequest( - final String accountId, - final String sessionId, - final String participantId) { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("accept", "application/json"); - - //prepare and invoke the API call request to fetch the response - HttpRequest request = getClientInstance().get(queryBuilder, headers, null, null); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for getParticipantSubscriptions. - * @return An object of type Subscriptions - */ - private ApiResponse handleGetParticipantSubscriptionsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - //extract result from the http response - String responseBody = ((HttpStringResponse) response).getBody(); - Subscriptions result = ApiHelper.deserialize(responseBody, - Subscriptions.class); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), result); - } - - /** - * Update a participant's subscriptions. This is a full update that will replace the - * participant's subscriptions. First call `getParticipantSubscriptions` if you need the current - * subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @param body Optional parameter: Initial state - * @throws ApiException Represents error response from the server. - * @throws IOException Signals that an I/O exception of some sort has occurred. - */ - public ApiResponse updateParticipantSubscriptions( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) throws ApiException, IOException { - HttpRequest request = buildUpdateParticipantSubscriptionsRequest(accountId, sessionId, - participantId, body); - authManagers.get("webRtc").apply(request); - - HttpResponse response = getClientInstance().execute(request, false); - HttpContext context = new HttpContext(request, response); - - return handleUpdateParticipantSubscriptionsResponse(context); - } - - /** - * Update a participant's subscriptions. This is a full update that will replace the - * participant's subscriptions. First call `getParticipantSubscriptions` if you need the current - * subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions. - * @param accountId Required parameter: Account ID - * @param sessionId Required parameter: Session ID - * @param participantId Required parameter: Participant ID - * @param body Optional parameter: Initial state - * @return Returns the Void wrapped in ApiResponse response from the API call - */ - public CompletableFuture> updateParticipantSubscriptionsAsync( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) { - return makeHttpCallAsync(() -> buildUpdateParticipantSubscriptionsRequest(accountId, - sessionId, participantId, body), - req -> authManagers.get("webRtc").applyAsync(req) - .thenCompose(request -> getClientInstance() - .executeAsync(request, false)), - context -> handleUpdateParticipantSubscriptionsResponse(context)); - } - - /** - * Builds the HttpRequest object for updateParticipantSubscriptions. - */ - private HttpRequest buildUpdateParticipantSubscriptionsRequest( - final String accountId, - final String sessionId, - final String participantId, - final Subscriptions body) throws JsonProcessingException { - //the base uri for api requests - String baseUri = config.getBaseUri(Server.WEBRTCDEFAULT); - - //prepare query string for API call - final StringBuilder queryBuilder = new StringBuilder(baseUri - + "/accounts/{accountId}/sessions/{sessionId}/participants/{participantId}/subscriptions"); - - //process template parameters - Map> templateParameters = new HashMap<>(); - templateParameters.put("accountId", - new SimpleEntry(accountId, false)); - templateParameters.put("sessionId", - new SimpleEntry(sessionId, false)); - templateParameters.put("participantId", - new SimpleEntry(participantId, false)); - ApiHelper.appendUrlWithTemplateParameters(queryBuilder, templateParameters); - - //load all headers for the outgoing API request - Headers headers = new Headers(); - headers.add("user-agent", BaseController.userAgent); - headers.add("content-type", "application/json"); - - //prepare and invoke the API call request to fetch the response - String bodyJson = ApiHelper.serialize(body); - HttpRequest request = getClientInstance().putBody(queryBuilder, headers, null, bodyJson); - - // Invoke the callback before request if its not null - if (getHttpCallback() != null) { - getHttpCallback().onBeforeRequest(request); - } - - return request; - } - - /** - * Processes the response for updateParticipantSubscriptions. - * @return An object of type void - */ - private ApiResponse handleUpdateParticipantSubscriptionsResponse( - HttpContext context) throws ApiException, IOException { - HttpResponse response = context.getResponse(); - - //invoke the callback after response if its not null - if (getHttpCallback() != null) { - getHttpCallback().onAfterResponse(context); - } - - //Error handling using HTTP status codes - int responseCode = response.getStatusCode(); - - if (responseCode == 400) { - throw new ApiException("Bad Request", context); - } - if (responseCode == 401) { - throw new ApiException("Unauthorized", context); - } - if (responseCode == 403) { - throw new ApiException("Access Denied", context); - } - if (responseCode == 404) { - throw new ApiException("Not Found", context); - } - if ((responseCode < 200) || (responseCode > 208)) { - throw new ErrorException("Unexpected Error", context); - } - //handle errors defined at the API level - validateResponse(response, context); - - return new ApiResponse(response.getStatusCode(), response.getHeaders(), null); - } - -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/webrtc/exceptions/ErrorException.java b/src/main/java/com/bandwidth/webrtc/exceptions/ErrorException.java deleted file mode 100644 index 27c45d10..00000000 --- a/src/main/java/com/bandwidth/webrtc/exceptions/ErrorException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.exceptions; - -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.http.client.HttpContext; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ErrorException type. - */ -public class ErrorException - extends ApiException { - private static final long serialVersionUID = 6300991168895097478L; - private int code; - private String message; - - /** - * Initialization constructor. - * @param reason The reason for throwing exception - * @param context The http context of the API exception - */ - public ErrorException(String reason, HttpContext context) { - super(reason, context); - } - - - /** - * Getter for Code. - * @return Returns the int - */ - @JsonGetter("code") - public int getCode() { - return this.code; - } - - /** - * Setter for Code. - * @param code Value for int - */ - @JsonSetter("code") - private void setCode(int code) { - this.code = code; - } - - /** - * Getter for Message. - * @return Returns the String - */ - @JsonGetter("message") - public String getMessage() { - return this.message; - } - - /** - * Setter for Message. - * @param message Value for String - */ - @JsonSetter("message") - private void setMessage(String message) { - this.message = message; - } -} diff --git a/src/main/java/com/bandwidth/webrtc/models/AccountsParticipantsResponse.java b/src/main/java/com/bandwidth/webrtc/models/AccountsParticipantsResponse.java deleted file mode 100644 index 868090e4..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/AccountsParticipantsResponse.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for AccountsParticipantsResponse type. - */ -public class AccountsParticipantsResponse { - @JsonInclude(JsonInclude.Include.NON_NULL) - private Participant participant; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String token; - - /** - * Default constructor. - */ - public AccountsParticipantsResponse() { - } - - /** - * Initialization constructor. - * @param participant Participant value for participant. - * @param token String value for token. - */ - public AccountsParticipantsResponse( - Participant participant, - String token) { - this.participant = participant; - this.token = token; - } - - /** - * Getter for Participant. - * A participant object - * @return Returns the Participant - */ - @JsonGetter("participant") - public Participant getParticipant() { - return participant; - } - - /** - * Setter for Participant. - * A participant object - * @param participant Value for Participant - */ - @JsonSetter("participant") - public void setParticipant(Participant participant) { - this.participant = participant; - } - - /** - * Getter for Token. - * Auth token for the returned participant This should be passed to the participant so that they - * can connect to the platform - * @return Returns the String - */ - @JsonGetter("token") - public String getToken() { - return token; - } - - /** - * Setter for Token. - * Auth token for the returned participant This should be passed to the participant so that they - * can connect to the platform - * @param token Value for String - */ - @JsonSetter("token") - public void setToken(String token) { - this.token = token; - } - - /** - * Converts this AccountsParticipantsResponse into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "AccountsParticipantsResponse [" + "participant=" + participant + ", token=" + token - + "]"; - } - - /** - * Builds a new {@link AccountsParticipantsResponse.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link AccountsParticipantsResponse.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .participant(getParticipant()) - .token(getToken()); - return builder; - } - - /** - * Class to build instances of {@link AccountsParticipantsResponse}. - */ - public static class Builder { - private Participant participant; - private String token; - - - - /** - * Setter for participant. - * @param participant Participant value for participant. - * @return Builder - */ - public Builder participant(Participant participant) { - this.participant = participant; - return this; - } - - /** - * Setter for token. - * @param token String value for token. - * @return Builder - */ - public Builder token(String token) { - this.token = token; - return this; - } - - /** - * Builds a new {@link AccountsParticipantsResponse} object using the set fields. - * @return {@link AccountsParticipantsResponse} - */ - public AccountsParticipantsResponse build() { - return new AccountsParticipantsResponse(participant, token); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/models/DeviceApiVersionEnum.java b/src/main/java/com/bandwidth/webrtc/models/DeviceApiVersionEnum.java deleted file mode 100644 index 9c7578e0..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/DeviceApiVersionEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * DeviceApiVersionEnum to be used. - */ -public enum DeviceApiVersionEnum { - V3, - - V2; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - V3.value = "V3"; - V2.value = "V2"; - - valueMap.put("V3", V3); - valueMap.put("V2", V2); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static DeviceApiVersionEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of DeviceApiVersionEnum values to list of string values. - * @param toConvert The list of DeviceApiVersionEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (DeviceApiVersionEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/webrtc/models/Participant.java b/src/main/java/com/bandwidth/webrtc/models/Participant.java deleted file mode 100644 index 2f225430..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/Participant.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import com.bandwidth.internal.OptionalNullable; -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.util.List; - -/** - * This is a model class for Participant type. - */ -public class Participant { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private OptionalNullable callbackUrl; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List publishPermissions; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List sessions; - @JsonInclude(JsonInclude.Include.NON_NULL) - private Subscriptions subscriptions; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - @JsonInclude(JsonInclude.Include.NON_NULL) - private DeviceApiVersionEnum deviceApiVersion; - - /** - * Default constructor. - */ - public Participant() { - deviceApiVersion = DeviceApiVersionEnum.V2; - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param callbackUrl String value for callbackUrl. - * @param publishPermissions List of PublishPermissionEnum value for publishPermissions. - * @param sessions List of String value for sessions. - * @param subscriptions Subscriptions value for subscriptions. - * @param tag String value for tag. - * @param deviceApiVersion DeviceApiVersionEnum value for deviceApiVersion. - */ - public Participant( - String id, - String callbackUrl, - List publishPermissions, - List sessions, - Subscriptions subscriptions, - String tag, - DeviceApiVersionEnum deviceApiVersion) { - this.id = id; - this.callbackUrl = OptionalNullable.of(callbackUrl); - this.publishPermissions = publishPermissions; - this.sessions = sessions; - this.subscriptions = subscriptions; - this.tag = tag; - this.deviceApiVersion = deviceApiVersion; - } - - /** - * Internal initialization constructor. - */ - protected Participant(String id, OptionalNullable callbackUrl, - List publishPermissions, List sessions, - Subscriptions subscriptions, String tag, DeviceApiVersionEnum deviceApiVersion) { - this.id = id; - this.callbackUrl = callbackUrl; - this.publishPermissions = publishPermissions; - this.sessions = sessions; - this.subscriptions = subscriptions; - this.tag = tag; - this.deviceApiVersion = deviceApiVersion; - } - - /** - * Getter for Id. - * Unique id of the participant - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * Unique id of the participant - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Internal Getter for CallbackUrl. - * Full callback url to use for notifications about this participant - * @return Returns the Internal String - */ - @JsonGetter("callbackUrl") - @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetCallbackUrl() { - return this.callbackUrl; - } - - /** - * Getter for CallbackUrl. - * Full callback url to use for notifications about this participant - * @return Returns the String - */ - public String getCallbackUrl() { - return OptionalNullable.getFrom(callbackUrl); - } - - /** - * Setter for CallbackUrl. - * Full callback url to use for notifications about this participant - * @param callbackUrl Value for String - */ - @JsonSetter("callbackUrl") - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = OptionalNullable.of(callbackUrl); - } - - /** - * UnSetter for CallbackUrl. - * Full callback url to use for notifications about this participant - */ - public void unsetCallbackUrl() { - callbackUrl = null; - } - - /** - * Getter for PublishPermissions. - * Defines if this participant can publish audio or video - * @return Returns the List of PublishPermissionEnum - */ - @JsonGetter("publishPermissions") - public List getPublishPermissions() { - return publishPermissions; - } - - /** - * Setter for PublishPermissions. - * Defines if this participant can publish audio or video - * @param publishPermissions Value for List of PublishPermissionEnum - */ - @JsonSetter("publishPermissions") - public void setPublishPermissions(List publishPermissions) { - this.publishPermissions = publishPermissions; - } - - /** - * Getter for Sessions. - * List of session ids this participant is associated with Capped to one - * @return Returns the List of String - */ - @JsonGetter("sessions") - public List getSessions() { - return sessions; - } - - /** - * Setter for Sessions. - * List of session ids this participant is associated with Capped to one - * @param sessions Value for List of String - */ - @JsonSetter("sessions") - public void setSessions(List sessions) { - this.sessions = sessions; - } - - /** - * Getter for Subscriptions. - * @return Returns the Subscriptions - */ - @JsonGetter("subscriptions") - public Subscriptions getSubscriptions() { - return subscriptions; - } - - /** - * Setter for Subscriptions. - * @param subscriptions Value for Subscriptions - */ - @JsonSetter("subscriptions") - public void setSubscriptions(Subscriptions subscriptions) { - this.subscriptions = subscriptions; - } - - /** - * Getter for Tag. - * User defined tag to associate with the participant - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * User defined tag to associate with the participant - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Getter for DeviceApiVersion. - * Optional field to define the device api version of this participant - * @return Returns the DeviceApiVersionEnum - */ - @JsonGetter("deviceApiVersion") - public DeviceApiVersionEnum getDeviceApiVersion() { - return deviceApiVersion; - } - - /** - * Setter for DeviceApiVersion. - * Optional field to define the device api version of this participant - * @param deviceApiVersion Value for DeviceApiVersionEnum - */ - @JsonSetter("deviceApiVersion") - public void setDeviceApiVersion(DeviceApiVersionEnum deviceApiVersion) { - this.deviceApiVersion = deviceApiVersion; - } - - /** - * Converts this Participant into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Participant [" + "id=" + id + ", callbackUrl=" + callbackUrl - + ", publishPermissions=" + publishPermissions + ", sessions=" + sessions - + ", subscriptions=" + subscriptions + ", tag=" + tag + ", deviceApiVersion=" - + deviceApiVersion + "]"; - } - - /** - * Builds a new {@link Participant.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Participant.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .publishPermissions(getPublishPermissions()) - .sessions(getSessions()) - .subscriptions(getSubscriptions()) - .tag(getTag()) - .deviceApiVersion(getDeviceApiVersion()); - builder.callbackUrl = internalGetCallbackUrl(); - return builder; - } - - /** - * Class to build instances of {@link Participant}. - */ - public static class Builder { - private String id; - private OptionalNullable callbackUrl; - private List publishPermissions; - private List sessions; - private Subscriptions subscriptions; - private String tag; - private DeviceApiVersionEnum deviceApiVersion = DeviceApiVersionEnum.V2; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for callbackUrl. - * @param callbackUrl String value for callbackUrl. - * @return Builder - */ - public Builder callbackUrl(String callbackUrl) { - this.callbackUrl = OptionalNullable.of(callbackUrl); - return this; - } - - /** - * UnSetter for callbackUrl. - * @return Builder - */ - public Builder unsetCallbackUrl() { - callbackUrl = null; - return this; - } - - /** - * Setter for publishPermissions. - * @param publishPermissions List of PublishPermissionEnum value for publishPermissions. - * @return Builder - */ - public Builder publishPermissions(List publishPermissions) { - this.publishPermissions = publishPermissions; - return this; - } - - /** - * Setter for sessions. - * @param sessions List of String value for sessions. - * @return Builder - */ - public Builder sessions(List sessions) { - this.sessions = sessions; - return this; - } - - /** - * Setter for subscriptions. - * @param subscriptions Subscriptions value for subscriptions. - * @return Builder - */ - public Builder subscriptions(Subscriptions subscriptions) { - this.subscriptions = subscriptions; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Setter for deviceApiVersion. - * @param deviceApiVersion DeviceApiVersionEnum value for deviceApiVersion. - * @return Builder - */ - public Builder deviceApiVersion(DeviceApiVersionEnum deviceApiVersion) { - this.deviceApiVersion = deviceApiVersion; - return this; - } - - /** - * Builds a new {@link Participant} object using the set fields. - * @return {@link Participant} - */ - public Participant build() { - return new Participant(id, callbackUrl, publishPermissions, sessions, subscriptions, - tag, deviceApiVersion); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/models/ParticipantSubscription.java b/src/main/java/com/bandwidth/webrtc/models/ParticipantSubscription.java deleted file mode 100644 index da36ca34..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/ParticipantSubscription.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for ParticipantSubscription type. - */ -public class ParticipantSubscription { - private String participantId; - - /** - * Default constructor. - */ - public ParticipantSubscription() { - } - - /** - * Initialization constructor. - * @param participantId String value for participantId. - */ - public ParticipantSubscription( - String participantId) { - this.participantId = participantId; - } - - /** - * Getter for ParticipantId. - * Participant the subscriber should be subscribed to - * @return Returns the String - */ - @JsonGetter("participantId") - public String getParticipantId() { - return participantId; - } - - /** - * Setter for ParticipantId. - * Participant the subscriber should be subscribed to - * @param participantId Value for String - */ - @JsonSetter("participantId") - public void setParticipantId(String participantId) { - this.participantId = participantId; - } - - /** - * Converts this ParticipantSubscription into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "ParticipantSubscription [" + "participantId=" + participantId + "]"; - } - - /** - * Builds a new {@link ParticipantSubscription.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link ParticipantSubscription.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(participantId); - return builder; - } - - /** - * Class to build instances of {@link ParticipantSubscription}. - */ - public static class Builder { - private String participantId; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param participantId String value for participantId. - */ - public Builder(String participantId) { - this.participantId = participantId; - } - - /** - * Setter for participantId. - * @param participantId String value for participantId. - * @return Builder - */ - public Builder participantId(String participantId) { - this.participantId = participantId; - return this; - } - - /** - * Builds a new {@link ParticipantSubscription} object using the set fields. - * @return {@link ParticipantSubscription} - */ - public ParticipantSubscription build() { - return new ParticipantSubscription(participantId); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/models/PublishPermissionEnum.java b/src/main/java/com/bandwidth/webrtc/models/PublishPermissionEnum.java deleted file mode 100644 index 1f7b4f8b..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/PublishPermissionEnum.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - -/** - * PublishPermissionEnum to be used. - */ -public enum PublishPermissionEnum { - AUDIO, - - VIDEO; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - AUDIO.value = "AUDIO"; - VIDEO.value = "VIDEO"; - - valueMap.put("AUDIO", AUDIO); - valueMap.put("VIDEO", VIDEO); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - @com.fasterxml.jackson.annotation.JsonCreator - public static PublishPermissionEnum fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @com.fasterxml.jackson.annotation.JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of PublishPermissionEnum values to list of string values. - * @param toConvert The list of PublishPermissionEnum values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (PublishPermissionEnum enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/bandwidth/webrtc/models/Session.java b/src/main/java/com/bandwidth/webrtc/models/Session.java deleted file mode 100644 index f546ea08..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/Session.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; - -/** - * This is a model class for Session type. - */ -public class Session { - @JsonInclude(JsonInclude.Include.NON_NULL) - private String id; - @JsonInclude(JsonInclude.Include.NON_NULL) - private String tag; - - /** - * Default constructor. - */ - public Session() { - } - - /** - * Initialization constructor. - * @param id String value for id. - * @param tag String value for tag. - */ - public Session( - String id, - String tag) { - this.id = id; - this.tag = tag; - } - - /** - * Getter for Id. - * Unique id of the session - * @return Returns the String - */ - @JsonGetter("id") - public String getId() { - return id; - } - - /** - * Setter for Id. - * Unique id of the session - * @param id Value for String - */ - @JsonSetter("id") - public void setId(String id) { - this.id = id; - } - - /** - * Getter for Tag. - * User defined tag to associate with the session - * @return Returns the String - */ - @JsonGetter("tag") - public String getTag() { - return tag; - } - - /** - * Setter for Tag. - * User defined tag to associate with the session - * @param tag Value for String - */ - @JsonSetter("tag") - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Converts this Session into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Session [" + "id=" + id + ", tag=" + tag + "]"; - } - - /** - * Builds a new {@link Session.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Session.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder() - .id(getId()) - .tag(getTag()); - return builder; - } - - /** - * Class to build instances of {@link Session}. - */ - public static class Builder { - private String id; - private String tag; - - - - /** - * Setter for id. - * @param id String value for id. - * @return Builder - */ - public Builder id(String id) { - this.id = id; - return this; - } - - /** - * Setter for tag. - * @param tag String value for tag. - * @return Builder - */ - public Builder tag(String tag) { - this.tag = tag; - return this; - } - - /** - * Builds a new {@link Session} object using the set fields. - * @return {@link Session} - */ - public Session build() { - return new Session(id, tag); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/models/Subscriptions.java b/src/main/java/com/bandwidth/webrtc/models/Subscriptions.java deleted file mode 100644 index ebd5a701..00000000 --- a/src/main/java/com/bandwidth/webrtc/models/Subscriptions.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * BandwidthLib - * - * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.bandwidth.webrtc.models; - -import com.fasterxml.jackson.annotation.JsonGetter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import java.util.List; - -/** - * This is a model class for Subscriptions type. - */ -public class Subscriptions { - private String sessionId; - @JsonInclude(JsonInclude.Include.NON_NULL) - private List participants; - - /** - * Default constructor. - */ - public Subscriptions() { - } - - /** - * Initialization constructor. - * @param sessionId String value for sessionId. - * @param participants List of ParticipantSubscription value for participants. - */ - public Subscriptions( - String sessionId, - List participants) { - this.sessionId = sessionId; - this.participants = participants; - } - - /** - * Getter for SessionId. - * Session the subscriptions are associated with If this is the only field, the subscriber will - * be subscribed to all participants in the session (including any participants that are later - * added to the session) - * @return Returns the String - */ - @JsonGetter("sessionId") - public String getSessionId() { - return sessionId; - } - - /** - * Setter for SessionId. - * Session the subscriptions are associated with If this is the only field, the subscriber will - * be subscribed to all participants in the session (including any participants that are later - * added to the session) - * @param sessionId Value for String - */ - @JsonSetter("sessionId") - public void setSessionId(String sessionId) { - this.sessionId = sessionId; - } - - /** - * Getter for Participants. - * Subset of participants to subscribe to in the session. Optional. - * @return Returns the List of ParticipantSubscription - */ - @JsonGetter("participants") - public List getParticipants() { - return participants; - } - - /** - * Setter for Participants. - * Subset of participants to subscribe to in the session. Optional. - * @param participants Value for List of ParticipantSubscription - */ - @JsonSetter("participants") - public void setParticipants(List participants) { - this.participants = participants; - } - - /** - * Converts this Subscriptions into string format. - * @return String representation of this class - */ - @Override - public String toString() { - return "Subscriptions [" + "sessionId=" + sessionId + ", participants=" + participants - + "]"; - } - - /** - * Builds a new {@link Subscriptions.Builder} object. - * Creates the instance with the state of the current model. - * @return a new {@link Subscriptions.Builder} object - */ - public Builder toBuilder() { - Builder builder = new Builder(sessionId) - .participants(getParticipants()); - return builder; - } - - /** - * Class to build instances of {@link Subscriptions}. - */ - public static class Builder { - private String sessionId; - private List participants; - - /** - * Initialization constructor. - */ - public Builder() { - } - - /** - * Initialization constructor. - * @param sessionId String value for sessionId. - */ - public Builder(String sessionId) { - this.sessionId = sessionId; - } - - /** - * Setter for sessionId. - * @param sessionId String value for sessionId. - * @return Builder - */ - public Builder sessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - * Setter for participants. - * @param participants List of ParticipantSubscription value for participants. - * @return Builder - */ - public Builder participants(List participants) { - this.participants = participants; - return this; - } - - /** - * Builds a new {@link Subscriptions} object using the set fields. - * @return {@link Subscriptions} - */ - public Subscriptions build() { - return new Subscriptions(sessionId, participants); - } - } -} diff --git a/src/main/java/com/bandwidth/webrtc/utils/WebRtcTransfer.java b/src/main/java/com/bandwidth/webrtc/utils/WebRtcTransfer.java deleted file mode 100644 index f8686471..00000000 --- a/src/main/java/com/bandwidth/webrtc/utils/WebRtcTransfer.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.bandwidth.webrtc.utils; - -public class WebRtcTransfer { - public static String generateBxml(String deviceToken, String voiceCallId) { - return WebRtcTransfer.generateBxml(deviceToken, voiceCallId, "sip:sipx.webrtc.bandwidth.com:5060"); - } - - public static String generateBxml(String deviceToken, String voiceCallId, String sipUri) { - return "\n" - + "" - + generateTransferVerb(deviceToken, voiceCallId, sipUri) - + "\n"; - } - - public static String generateTransferVerb(String deviceToken, String voiceCallId, String sipUri) { - String formattedCallId = String.join("", voiceCallId.split("-", 2)[1].split("-")); - return "\n" - + "\t" + sipUri + "\n" - + ""; - } -} diff --git a/src/test/java/com/bandwidth/BxmlTest.java b/src/test/java/com/bandwidth/BxmlTest.java deleted file mode 100644 index 4568e7c1..00000000 --- a/src/test/java/com/bandwidth/BxmlTest.java +++ /dev/null @@ -1,633 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.voice.bxml.verbs.*; -import com.bandwidth.voice.bxml.verbs.Record; -import com.bandwidth.webrtc.utils.WebRtcTransfer; - -import org.junit.Test; - -import static org.junit.Assert.*; - -import java.util.ArrayList; - -/** - * Unit tests for BXML - */ -public class BxmlTest { - - @Test - public void testBridge() { - Bridge bridge = Bridge.builder() - .callId("c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d") - .bridgeCompleteUrl("https://test.com") - .bridgeCompleteMethod("GET") - .bridgeTargetCompleteUrl("https://test2.com") - .bridgeTargetCompleteMethod("POST") - .username("user") - .password("pass") - .tag("custom tag") - .bridgeCompleteFallbackUrl("https://test3.com") - .bridgeCompleteFallbackMethod("GET") - .bridgeTargetCompleteFallbackUrl("https://test4.com") - .bridgeTargetCompleteFallbackMethod("POST") - .fallbackUsername("fuser") - .fallbackPassword("fpass") - .build(); - - String response = new Response() - .add(bridge) - .toBXML(); - String expected = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testConference() { - ArrayList callIdsToCoach = new ArrayList(); - callIdsToCoach.add("id1"); - callIdsToCoach.add("id2"); - Conference conference = Conference.builder() - .hold(true) - .mute(true) - .tag("tag1") - .username("user") - .password("pass") - .callIdsToCoach(callIdsToCoach) - .conferenceEventMethod("POST") - .conferenceEventUrl("https://example.com") - .name("my conference") - .build(); - - String response = new Response() - .add(conference) - .toBXML(); - String expected = "my conference"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testSpeakSentence() { - SpeakSentence speakSentence = SpeakSentence.builder() - .text("test") - .voice("susan") - .gender("female") - .locale("en_US") - .build(); - - String response = new Response() - .add(speakSentence) - .toBXML(); - String expected = "test"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testSpeakSentenceWithSsml() { - SpeakSentence speakSentence = SpeakSentence.builder() - .text("Hello, you have reached the home of Antonio Mendoza.Please leave a message.") - .build(); - - String response = new Response() - .add(speakSentence) - .toBXML(); - String expected = "Hello, you have reached the home of Antonio Mendoza.Please leave a message."; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testPlayAudio() { - PlayAudio playAudio = PlayAudio.builder() - .audioUri("https://test.com") - .username("user") - .password("pass") - .build(); - - String response = new Response() - .add(playAudio) - .toBXML(); - String expected = "https://test.com"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testGather() { - Gather gather = Gather.builder() - .gatherUrl("https://test.com") - .gatherMethod("GET") - .username("user") - .password("pass") - .tag("tag") - .terminatingDigits("123") - .maxDigits(3) - .interDigitTimeout(4.0) - .firstDigitTimeout(5.0) - .repeatCount(6) - .gatherFallbackUrl("https://test2.com") - .gatherFallbackMethod("POST") - .fallbackUsername("fuser") - .fallbackPassword("fpass") - .build(); - - String response = new Response() - .add(gather) - .toBXML(); - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testNestedGatherMultipleVerbs() { - SpeakSentence speakSentence = SpeakSentence.builder() - .text("test") - .build(); - PlayAudio playAudio = PlayAudio.builder() - .audioUri("https://test.com") - .build(); - ArrayList audioProducers = new ArrayList(); - audioProducers.add(speakSentence); - audioProducers.add(playAudio); - - Gather gather = Gather.builder() - .audioProducer(audioProducers) - .build(); - - String response = new Response() - .add(gather) - .toBXML(); - String expected = "testhttps://test.com"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testNestedGatherSingleVerb() { - SpeakSentence speakSentence = SpeakSentence.builder() - .text("test") - .build(); - - Gather gather = Gather.builder() - .audioProducer(speakSentence) - .build(); - - String response = new Response() - .add(gather) - .toBXML(); - String expected = "test"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testResponse() { - String response = new Response() - .toBXML(); - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testBxml() { - String bxml = new Bxml() - .toBXML(); - String expected = ""; - - assertEquals("BXML strings not equal", expected, bxml); - } - - @Test - public void testBxmlSpeakSentence() { - SpeakSentence speakSentence = SpeakSentence.builder() - .text("test") - .voice("susan") - .gender("female") - .locale("en_US") - .build(); - - String bxml = new Bxml() - .add(speakSentence) - .toBXML(); - String expected = "test"; - - assertEquals("BXML strings not equal", expected, bxml); - } - - @Test - public void testHangup() { - Hangup hangup = Hangup.builder().build(); - - String response = new Response() - .add(hangup) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testSendDtmf() { - SendDtmf sendDtmf = SendDtmf.builder() - .digits("321") - .toneDuration(75.0) - .toneInterval(50.0) - .build(); - - String response = new Response() - .add(sendDtmf) - .toBXML(); - - String expected = "321"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testForward() { - Forward forward = Forward.builder() - .to("+18887775555") - .from("+8887779999") - .callTimeout(3) - .diversionTreatment("none") - .diversionReason("away") - .build(); - - String response = new Response() - .add(forward) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testPause() { - Pause pause = Pause.builder() - .duration(3.0) - .build(); - - String response = new Response() - .add(pause) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testRedirect() { - Redirect redirect = Redirect.builder() - .username("user") - .password("pass") - .redirectUrl("https://test.com") - .redirectMethod("GET") - .tag("tag") - .redirectFallbackUrl("https://test2.com") - .redirectFallbackMethod("POST") - .fallbackUsername("fuser") - .fallbackPassword("fpass") - .build(); - - String response = new Response() - .add(redirect) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testTransfer() { - PhoneNumber phoneNumber = PhoneNumber.builder() - .phoneNumber("+17776665555") - .transferAnswerUrl("https://test.com") - .transferAnswerMethod("GET") - .username("user") - .password("pass") - .tag("tag") - .transferAnswerFallbackUrl("https://test2.com") - .transferAnswerFallbackMethod("POST") - .fallbackUsername("fuser") - .fallbackPassword("fpass") - .build(); - ArrayList phoneNumbers = new ArrayList(); - phoneNumbers.add(phoneNumber); - SipUri sipUri = SipUri.builder() - .sipUri("sip-uri") - .uui("uui") - .transferAnswerUrl("https://test3.com") - .transferAnswerMethod("POST") - .username("user2") - .password("pass2") - .tag("tag2") - .transferAnswerFallbackUrl("https://test4.com") - .transferAnswerFallbackMethod("POST") - .fallbackUsername("fuser2") - .fallbackPassword("fpass2") - .build(); - ArrayList sipUris = new ArrayList(); - sipUris.add(sipUri); - Transfer transfer = Transfer.builder() - .transferCallerId("+18888888888") - .callTimeout(3.0) - .tag("tag3") - .transferCompleteUrl("https://testtransfer.com") - .transferCompleteMethod("GET") - .username("usertransfer") - .password("passtransfer") - .diversionTreatment("none") - .diversionReason("away") - .transferCompleteFallbackUrl("https://test7.com") - .transferCompleteFallbackMethod("POST") - .fallbackUsername("fuser7") - .fallbackPassword("fpass7") - .phoneNumbers(phoneNumbers) - .sipUris(sipUris) - .build(); - - String response = new Response() - .add(transfer) - .toBXML(); - - String expected = "+17776665555sip-uri"; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testRecord() { - Record record = Record.builder() - .recordCompleteUrl("https://url.com") - .recordCompleteMethod("POST") - .recordingAvailableUrl("https://url.com") - .recordingAvailableMethod("POST") - .username("user") - .password("pass") - .tag("tag") - .terminatingDigits("123") - .maxDuration(3) - .fileFormat("wav") - .recordCompleteFallbackUrl("https://test.com") - .recordCompleteFallbackMethod("GET") - .fallbackUsername("fuser") - .fallbackPassword("fpass") - .detectLanguage(true) - .build(); - - String response = new Response() - .add(record) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStartRecording() { - StartRecording startRecording = StartRecording.builder() - .recordingAvailableUrl("https://url.com") - .recordingAvailableMethod("POST") - .username("user") - .password("pass") - .tag("tag") - .fileFormat("wav") - .multiChannel(false) - .detectLanguage(true) - .build(); - - String response = new Response() - .add(startRecording) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testPauseRecording() { - PauseRecording pauseRecording = PauseRecording.builder().build(); - - String response = new Response() - .add(pauseRecording) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testResumeRecording() { - ResumeRecording resumeRecording = ResumeRecording.builder().build(); - - String response = new Response() - .add(resumeRecording) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStopRecording() { - StopRecording stopRecording = StopRecording.builder().build(); - - String response = new Response() - .add(stopRecording) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStartStream() { - StreamParam streamParam1 = StreamParam.builder() - .name("name1") - .value("value1") - .build(); - StreamParam streamParam2 = StreamParam.builder() - .name("name2") - .value("value2") - .build(); - ArrayList streamParams = new ArrayList(); - streamParams.add(streamParam1); - streamParams.add(streamParam2); - StartStream startStream = StartStream.builder() - .destination("https://url.com") - .streamEventMethod("POST") - .username("user") - .password("pass") - .name("test") - .tracks("inbound") - .streamEventUrl("https://url.com") - .streamParams(streamParams) - .build(); - - String response = new Response() - .add(startStream) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStopStream() { - StopStream stopStream = StopStream.builder() - .name("test") - .build(); - - String response = new Response() - .add(stopStream) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testRing() { - Ring ring = Ring.builder() - .duration(3.0) - .answerCall(false) - .build(); - - String response = new Response() - .add(ring) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testRingDefault() { - Ring ring = Ring.builder().build(); - String response = new Response().add(ring).toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStopGather() { - StopGather stopGather = StopGather.builder().build(); - - String response = new Response() - .add(stopGather) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testStartGather() { - StartGather startGather = StartGather.builder().build(); - - String response = new Response() - .add(startGather) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } - - @Test - public void testGenerateBxmlTwoParams() { - String response = WebRtcTransfer.generateBxml("asdf", "c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4"); - String expected = "\n" - + "\n" - + "\tsip:sipx.webrtc.bandwidth.com:5060\n" - + "\n"; - assertEquals("BXML strings are equal", expected, response); - } - - @Test - public void testGenerateBxmlThreeParams() { - String response = WebRtcTransfer.generateBxml("asdf", "c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4", - "sip1:sipx.webrtc.bandwidth.com:5060"); - String expected = "\n" - + "\n" - + "\tsip1:sipx.webrtc.bandwidth.com:5060\n" - + "\n"; - assertEquals("BXML strings are equal", expected, response); - } - - @Test - public void testGenerateBxmlVerb() { - String response = WebRtcTransfer.generateTransferVerb("asdf", "c-93d6f3c0-be584596-0b74-4fa2-8015-d8ede84bd1a4", - "sip:sipx.webrtc.bandwidth.com:5060"); - String expected = "\n" - + "\tsip:sipx.webrtc.bandwidth.com:5060\n" - + ""; - assertEquals("BXML strings are equal", expected, response); - } - - @Test - public void testStartTranscriptionBxmlVerb() { - CustomParam customParam1 = CustomParam.builder() - .name("name1") - .value("value1") - .build(); - CustomParam customParam2 = CustomParam.builder() - .name("name2") - .value("value2") - .build(); - ArrayList customParams = new ArrayList(); - customParams.add(customParam1); - customParams.add(customParam2); - StartTranscription startTranscription = StartTranscription.builder() - .destination("https://url.com") - .transcriptionEventMethod("POST") - .username("user") - .password("pass") - .name("test_transcription") - .tracks("inbound") - .transcriptionEventUrl("https://url.com") - .customParams(customParams) - .build(); - - String response = new Response() - .add(startTranscription) - .toBXML(); - - String expected = ""; - assertEquals("BXML strings are equal", expected, response); - } - - @Test - public void testStopTranscription() { - StopTranscription stopTranscription = StopTranscription.builder() - .name("test") - .build(); - - String response = new Response() - .add(stopTranscription) - .toBXML(); - - String expected = ""; - - assertEquals("BXML strings not equal", expected, response); - } -} diff --git a/src/test/java/com/bandwidth/MessagingApiTest.java b/src/test/java/com/bandwidth/MessagingApiTest.java deleted file mode 100644 index b9c6d817..00000000 --- a/src/test/java/com/bandwidth/MessagingApiTest.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.messaging.controllers.APIController; - -import com.bandwidth.messaging.models.MessageRequest; -import com.bandwidth.messaging.models.BandwidthMessage; -import com.bandwidth.messaging.exceptions.MessagingException; -import com.bandwidth.utilities.FileWrapper; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.nio.file.Files; -import java.util.Collections; -import java.util.concurrent.CompletableFuture; - -import org.junit.*; -import static org.junit.Assert.*; - -import static com.bandwidth.TestingEnvironmentVariables.*; - -/* - * Integration tests between the SDK and Messaging API - */ -public class MessagingApiTest { - - private APIController controller; - - @Before - public void initTest(){ - BandwidthClient client = new BandwidthClient.Builder() - .messagingBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - controller = client.getMessagingClient().getAPIController(); - } - - @Test - public void testCreateMessage() throws Exception { - final String text = "Java Test"; - - MessageRequest body = new MessageRequest.Builder() - .to(Collections.singletonList(USER_NUMBER)) - .from(BW_NUMBER) - .text(text) - .applicationId(MESSAGING_APPLICATION_ID) - .build(); - - ApiResponse apiResponse = controller.createMessage(ACCOUNT_ID, body); - assertEquals("Response Code is not 202", 202, apiResponse.getStatusCode()); - BandwidthMessage response = apiResponse.getResult(); - assertNotNull("Message ID is null", response.getId()); - assertFalse("Message ID is empty", response.getId().isEmpty()); - assertEquals("Message ID is not 29 characters", 29, response.getId().length()); - assertEquals("Application ID not equal", MESSAGING_APPLICATION_ID, response.getApplicationId()); - assertEquals("To phone number not equal", USER_NUMBER, response.getTo().get(0)); - assertEquals("From phone number not equal", BW_NUMBER, response.getFrom()); - assertEquals("Text not equal", text, response.getText()); - } - - @Test - public void testCreateMessageInvalidPhoneNumber() throws Exception { - MessageRequest body = new MessageRequest.Builder() - .to(Collections.singletonList("+1invalid")) - .from(BW_NUMBER) - .text("Java Test") - .applicationId(MESSAGING_APPLICATION_ID) - .build(); - - MessagingException e = assertThrows( - "Messaging Exception not thrown", - MessagingException.class, - () -> controller.createMessage(ACCOUNT_ID, body) - ); - assertEquals("Response Code is not 400", 400, e.getResponseCode()); - } - - @Test - public void testUploadDownloadDeleteMedia() throws Exception { - final String fileName = "src/test/resources/mediaUpload.png"; - final String contentType = "image/png"; - - File file = new File(fileName); - byte[] fileContents = Files.readAllBytes(file.toPath()); - FileWrapper body = new FileWrapper(file, contentType); - - final String mediaId = "java-media-test_" + java.util.UUID.randomUUID(); - - ApiResponse uploadMediaApiResponse = controller.uploadMedia(ACCOUNT_ID, mediaId, body, contentType, "no-cache"); - assertEquals("Response Code is not 204", 204, uploadMediaApiResponse.getStatusCode()); - - ApiResponse downloadMediaApiResponse = controller.getMedia(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 200", 200, downloadMediaApiResponse.getStatusCode()); - - InputStream downloadMediaResponse = downloadMediaApiResponse.getResult(); - - int bRead; - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - while ((bRead = downloadMediaResponse.read()) != -1){ - byteArrayOutputStream.write(bRead); - } - byte[] responseContents = byteArrayOutputStream.toByteArray(); - - assertArrayEquals("Media download not equal to media upload", fileContents, responseContents); - - ApiResponse deleteMediaApiResponse = controller.deleteMedia(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 204", 204, deleteMediaApiResponse.getStatusCode()); - } - - @Test - public void testUploadDownloadDeleteBinaryMedia() throws Exception { - final String fileName = "src/test/resources/mediaUpload.png"; - final String contentType = "image/png"; - - File file = new File(fileName); - byte[] fileContents = Files.readAllBytes(file.toPath()); - FileWrapper body = new FileWrapper(fileContents, contentType); - - final String mediaId = "java-media-binary-test_" + java.util.UUID.randomUUID(); - - ApiResponse uploadMediaApiResponse = controller.uploadMedia(ACCOUNT_ID, mediaId, body, contentType, "no-cache"); - assertEquals("Response Code is not 204", 204, uploadMediaApiResponse.getStatusCode()); - - ApiResponse downloadMediaApiResponse = controller.getMedia(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 200", 200, downloadMediaApiResponse.getStatusCode()); - - InputStream downloadMediaResponse = downloadMediaApiResponse.getResult(); - - int bRead; - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - while ((bRead = downloadMediaResponse.read()) != -1){ - byteArrayOutputStream.write(bRead); - } - byte[] responseContents = byteArrayOutputStream.toByteArray(); - - assertArrayEquals("Media download not equal to media upload", fileContents, responseContents); - - ApiResponse deleteMediaApiResponse = controller.deleteMedia(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 204", 204, deleteMediaApiResponse.getStatusCode()); - } - - @Test - public void testUploadDownloadDeleteMediaAsync() throws Exception { - final String fileName = "src/test/resources/mediaUpload.png"; - final String contentType = "image/png"; - - File file = new File(fileName); - byte[] fileContents = Files.readAllBytes(file.toPath()); - FileWrapper body = new FileWrapper(file, contentType); - - final String mediaId = "java-media-test_" + java.util.UUID.randomUUID(); - - CompletableFuture> uploadMediaApiResponseAsync = controller.uploadMediaAsync(ACCOUNT_ID, mediaId, body, contentType, "no-cache"); - assertEquals("Response Code is not 204", 204, uploadMediaApiResponseAsync.get().getStatusCode()); - - CompletableFuture> asyncDownloadMediaAPiResponse = controller.getMediaAsync(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 200", 200, asyncDownloadMediaAPiResponse.get().getStatusCode()); - - InputStream asyncDownloadMediaResponse = asyncDownloadMediaAPiResponse.get().getResult(); - - int asyncBRead; - ByteArrayOutputStream asyncByteArrayOutputStream = new ByteArrayOutputStream(); - while ((asyncBRead = asyncDownloadMediaResponse.read()) != -1){ - asyncByteArrayOutputStream.write(asyncBRead); - } - byte[] asyncResponseContents = asyncByteArrayOutputStream.toByteArray(); - - assertArrayEquals("Media download not equal to media upload", fileContents, asyncResponseContents); - - CompletableFuture> deleteMediaApiResponseAsync = controller.deleteMediaAsync(ACCOUNT_ID, mediaId); - assertEquals("Response Code is not 204", 204, deleteMediaApiResponseAsync.get().getStatusCode()); - } -} diff --git a/src/test/java/com/bandwidth/MfaApiTest.java b/src/test/java/com/bandwidth/MfaApiTest.java deleted file mode 100644 index 8beb6eae..00000000 --- a/src/test/java/com/bandwidth/MfaApiTest.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.multifactorauth.controllers.MFAController; - -import com.bandwidth.multifactorauth.exceptions.ErrorWithRequestException; -import com.bandwidth.multifactorauth.models.*; - -import org.junit.*; -import static org.junit.Assert.*; - -import static com.bandwidth.TestingEnvironmentVariables.*; - -/* - * Integration tests between the SDK and MFA API - */ -public class MfaApiTest { - - private MFAController controller; - - @Before - public void initTest(){ - BandwidthClient client = new BandwidthClient.Builder() - .multiFactorAuthBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - controller = client.getMultiFactorAuthClient().getMFAController(); - } - - @Test - public void testMfaMessaging() throws Exception { - TwoFactorCodeRequestSchema body = new TwoFactorCodeRequestSchema.Builder() - .to(USER_NUMBER) - .from(BW_NUMBER) - .applicationId(MESSAGING_APPLICATION_ID) - .scope("scope") - .digits(6) - .message("Your temporary {NAME} {SCOPE} code is {CODE}") - .build(); - - ApiResponse apiResponse = controller.createMessagingTwoFactor(ACCOUNT_ID, body); - assertEquals("Response Code is not 200", 200, apiResponse.getStatusCode()); - - TwoFactorMessagingResponse response = apiResponse.getResult(); - assertNotNull("MessageID is null", response.getMessageId()); - assertFalse("MessageID is empty", response.getMessageId().isEmpty()); - assertEquals("MessageID is not 29 characters", 29, response.getMessageId().length()); - } - - @Test - public void testMfaVoice() throws Exception { - TwoFactorCodeRequestSchema body = new TwoFactorCodeRequestSchema.Builder() - .to(USER_NUMBER) - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .scope("scope") - .digits(6) - .message("Your temporary {NAME} {SCOPE} code is {CODE}") - .build(); - - ApiResponse apiResponse = controller.createVoiceTwoFactor(ACCOUNT_ID, body); - assertEquals("Response Code is not 200", 200, apiResponse.getStatusCode()); - - TwoFactorVoiceResponse response = apiResponse.getResult(); - assertNotNull("CallID is null", response.getCallId()); - assertFalse("CallID is empty", response.getCallId().isEmpty()); - assertEquals("CallID is not 47 characters", 47, response.getCallId().length()); - } - - @Test - public void testMfaMessagingInvalidPhoneNumber() throws Exception { - TwoFactorCodeRequestSchema body = new TwoFactorCodeRequestSchema.Builder() - .to("+1invalid") - .from(BW_NUMBER) - .applicationId(MESSAGING_APPLICATION_ID) - .scope("scope") - .digits(6) - .message("Your temporary {NAME} {SCOPE} code is {CODE}") - .build(); - - ErrorWithRequestException e = assertThrows( - "ErrorWithRequest Exception not thrown", - ErrorWithRequestException.class, - ()->controller.createMessagingTwoFactor(ACCOUNT_ID, body) - ); - assertEquals("Response Code is not 400", 400, e.getResponseCode()); - } - - @Test - public void testMfaVoiceInvalidPhoneNumber() throws Exception { - TwoFactorCodeRequestSchema body = new TwoFactorCodeRequestSchema.Builder() - .to("+1invalid") - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .scope("scope") - .digits(6) - .message("Your temporary {NAME} {SCOPE} code is {CODE}") - .build(); - - ErrorWithRequestException e = assertThrows( - "ErrorWithRequest Exception not thrown", - ErrorWithRequestException.class, - ()->controller.createVoiceTwoFactor(ACCOUNT_ID, body) - ); - assertEquals("Response Code not 400", 400, e.getResponseCode()); - } - - @Test - public void testMfaVerify() throws Exception { - - java.util.Random wheelOfPhoneNumbers = new java.util.Random(System.currentTimeMillis()); - - TwoFactorVerifyRequestSchema body = new TwoFactorVerifyRequestSchema.Builder() - .to("+1000" + wheelOfPhoneNumbers.nextInt(10000000)) - .applicationId(VOICE_APPLICATION_ID) - .scope("scope") - .code("1234567") - .expirationTimeInMinutes(3) - .build(); - - ApiResponse apiResponse = controller.createVerifyTwoFactor(ACCOUNT_ID, body); - assertEquals("Response Code is not 200", 200, apiResponse.getStatusCode()); - - TwoFactorVerifyCodeResponse response = apiResponse.getResult(); - assertFalse("Code should be invalid", response.getValid()); - } - - @Test - public void testMfaVerifyInvalidPhoneNumber() throws Exception { - TwoFactorVerifyRequestSchema body = new TwoFactorVerifyRequestSchema.Builder() - .to("+1invalid") - .applicationId(VOICE_APPLICATION_ID) - .scope("scope") - .code("123456") - .expirationTimeInMinutes(3) - .build(); - - ErrorWithRequestException e = assertThrows( - "ErrorWithRequest Exception not thrown", - ErrorWithRequestException.class, - ()->controller.createVerifyTwoFactor(ACCOUNT_ID, body) - ); - assertEquals("Response Code not 400", 400, e.getResponseCode()); - } -} diff --git a/src/test/java/com/bandwidth/TestingEnvironmentVariables.java b/src/test/java/com/bandwidth/TestingEnvironmentVariables.java deleted file mode 100644 index 9ad6b237..00000000 --- a/src/test/java/com/bandwidth/TestingEnvironmentVariables.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.bandwidth; - -public final class TestingEnvironmentVariables { - - static final String USERNAME = System.getenv("BW_USERNAME"); - static final String PASSWORD = System.getenv("BW_PASSWORD"); - static final String ACCOUNT_ID = System.getenv("BW_ACCOUNT_ID"); - static final String USER_NUMBER = System.getenv("USER_NUMBER"); - static final String BW_NUMBER = System.getenv("BW_NUMBER"); - static final String MESSAGING_APPLICATION_ID = System.getenv("BW_MESSAGING_APPLICATION_ID"); - static final String VOICE_APPLICATION_ID = System.getenv("BW_VOICE_APPLICATION_ID"); - static final String BASE_CALLBACK_URL = System.getenv("BASE_CALLBACK_URL"); - - /* This is a utility class that shouldn't be instantiated */ - private TestingEnvironmentVariables(){} -} diff --git a/src/test/java/com/bandwidth/TnLookupApiTest.java b/src/test/java/com/bandwidth/TnLookupApiTest.java deleted file mode 100644 index e717f242..00000000 --- a/src/test/java/com/bandwidth/TnLookupApiTest.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.phonenumberlookup.controllers.APIController; - -import com.bandwidth.phonenumberlookup.models.OrderRequest; -import com.bandwidth.phonenumberlookup.models.OrderResponse; - -import com.bandwidth.phonenumberlookup.models.OrderStatus; -import org.junit.*; -import static org.junit.Assert.*; - -import java.util.Collections; - -import static com.bandwidth.TestingEnvironmentVariables.*; - -public class TnLookupApiTest { - - private APIController controller; - - @Before - public void initTest(){ - BandwidthClient client = new BandwidthClient.Builder() - .phoneNumberLookupBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - controller = client.getPhoneNumberLookupClient().getAPIController(); - } - - @Test - public void testPhoneNumberLookup() throws Exception { - OrderRequest body = new OrderRequest.Builder() - .tns(Collections.singletonList(USER_NUMBER)) - .build(); - - ApiResponse orderApiResponse = controller.createLookupRequest(ACCOUNT_ID, body); - assertEquals("Response Code is not 202", 202, orderApiResponse.getStatusCode()); - - OrderResponse orderResponse = orderApiResponse.getResult(); - assertNotNull("RequestID is null", orderResponse.getRequestId()); - assertFalse("RequestID is empty", orderResponse.getRequestId().isEmpty()); - assertEquals("Request ID is not 36 characters", 36, orderResponse.getRequestId().length()); - assertTrue( - "Status is not a valid value", - orderResponse.getStatus().equals("COMPLETE") || - orderResponse.getStatus().equals("PARTIAL_COMPLETE") || - orderResponse.getStatus().equals("FAILED") || - orderResponse.getStatus().equals("IN_PROGRESS") - ); - - ApiResponse statusApiResponse = controller.getLookupRequestStatus(ACCOUNT_ID, orderResponse.getRequestId()); - assertEquals("Response Code is not 200", 200, statusApiResponse.getStatusCode()); - - OrderStatus statusResponse = statusApiResponse.getResult(); - assertNotNull("RequestID is null", statusResponse.getRequestId()); - assertFalse("RequestId is empty", statusResponse.getRequestId().isEmpty()); - assertEquals("Request ID is not 36 characters", 36, statusResponse.getRequestId().length()); - assertTrue( - "Status is not a valid value", - statusResponse.getStatus().equals("COMPLETE") || - statusResponse.getStatus().equals("PARTIAL_COMPLETE") || - statusResponse.getStatus().equals("FAILED") || - statusResponse.getStatus().equals("IN_PROGRESS") - ); - } -} \ No newline at end of file diff --git a/src/test/java/com/bandwidth/VoiceApiTest.java b/src/test/java/com/bandwidth/VoiceApiTest.java deleted file mode 100644 index 408cee53..00000000 --- a/src/test/java/com/bandwidth/VoiceApiTest.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.internal.OptionalNullable; -import com.bandwidth.voice.controllers.APIController; - -import com.bandwidth.voice.exceptions.ApiErrorException; -import com.bandwidth.exceptions.ApiException; -import com.bandwidth.voice.models.*; -import org.junit.*; - -import javax.swing.text.html.Option; - -import java.time.LocalDateTime; -import static org.junit.Assert.*; - -import static com.bandwidth.TestingEnvironmentVariables.*; - -/* - * Integration tests between the SDK and Voice API - */ -public class VoiceApiTest { - - private APIController controller; - - @Before - public void initTest() { - BandwidthClient client = new BandwidthClient.Builder() - .voiceBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - controller = client.getVoiceClient().getAPIController(); - } - - @Test - public void testCreateCallAndGetCallState() throws Exception { - final String answerUrl = BASE_CALLBACK_URL.concat("/callbacks/outbound"); - - CreateCallRequest body = new CreateCallRequest.Builder() - .to(USER_NUMBER) - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .answerUrl(answerUrl) - .build(); - - ApiResponse createCallApiResponse = controller.createCall(ACCOUNT_ID, body); - - assertEquals("Response Code is not 201", 201, createCallApiResponse.getStatusCode()); - - CreateCallResponse createCallResponse = createCallApiResponse.getResult(); - assertNotNull("Call ID is null", createCallResponse.getCallId()); - assertFalse("Call ID is empty", createCallResponse.getCallId().isEmpty()); - assertEquals("Call ID is not 47 characters", 47, createCallResponse.getCallId().length()); - assertEquals("Application ID for create call not equal", VOICE_APPLICATION_ID, - createCallResponse.getApplicationId()); - assertEquals("To phone number for create call not equal", USER_NUMBER, createCallResponse.getTo()); - assertEquals("From phone number for create call not equal", BW_NUMBER, createCallResponse.getFrom()); - assertNotNull("enqueuedTime is null", createCallResponse.getEnqueuedTime()); - assertEquals("enqueuedTime is not a LocalDateTime object", LocalDateTime.class, - createCallResponse.getEnqueuedTime().getClass()); - try { - - ApiResponse callStateApiResponse = controller.getCall(ACCOUNT_ID, - createCallResponse.getCallId()); - assertEquals("Response Code is not 200", 200, callStateApiResponse.getStatusCode()); - - CallState callStateResponse = callStateApiResponse.getResult(); - assertEquals("Application ID for call state not equal", VOICE_APPLICATION_ID, - callStateResponse.getApplicationId()); - assertEquals("To phone number for call state not equal", USER_NUMBER, callStateResponse.getTo()); - assertEquals("From phone number for call state not equal", BW_NUMBER, callStateResponse.getFrom()); - assertEquals("Call ID not equal", createCallResponse.getCallId(), callStateResponse.getCallId()); - assertNotNull("enqueuedTime is null", createCallResponse.getEnqueuedTime()); - assertEquals("enqueuedTime is not a LocalDateTime object", LocalDateTime.class, - createCallResponse.getEnqueuedTime().getClass()); - } catch (ApiException e) { - assertEquals("Response Code is not 404", 404, e.getResponseCode()); - }} - - - - @Test - public void testCreateCallWithAmdAndGetCallState() throws Exception { - final String answerUrl = BASE_CALLBACK_URL.concat("/callbacks/outbound"); - final String machineDetectionUrl = BASE_CALLBACK_URL.concat("/callbacks/machineDetection"); - - MachineDetectionConfiguration machineDetectionConfiguration = new MachineDetectionConfiguration.Builder() - .mode(ModeEnum.ASYNC) - .callbackUrl(machineDetectionUrl) - .callbackMethod(CallbackMethodEnum.POST) - .detectionTimeout(5.0) - .silenceTimeout(5.0) - .speechThreshold(5.0) - .speechEndThreshold(5.0) - .delayResult(true) - .build(); - - CreateCallRequest body = new CreateCallRequest.Builder() - .to(USER_NUMBER) - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .answerUrl(answerUrl) - .machineDetection(machineDetectionConfiguration) - .build(); - - ApiResponse createCallApiResponse = controller.createCall(ACCOUNT_ID, body); - assertEquals("Response Code is not 201", 201, createCallApiResponse.getStatusCode()); - - CreateCallResponse createCallResponse = createCallApiResponse.getResult(); - assertNotNull("Call ID is null", createCallResponse.getCallId()); - assertFalse("Call ID is empty", createCallResponse.getCallId().isEmpty()); - assertEquals("Call ID is not 47 characters", 47, createCallResponse.getCallId().length()); - assertEquals("Application ID for create call not equal", VOICE_APPLICATION_ID, - createCallResponse.getApplicationId()); - assertEquals("To phone number for create call not equal", USER_NUMBER, createCallResponse.getTo()); - assertEquals("From phone number for create call not equal", BW_NUMBER, createCallResponse.getFrom()); - - try { - ApiResponse callStateApiResponse = controller.getCall(ACCOUNT_ID, - createCallResponse.getCallId()); - CallState callStateResponse = callStateApiResponse.getResult(); - assertEquals("Application ID for call state not equal", VOICE_APPLICATION_ID, - callStateResponse.getApplicationId()); - assertEquals("To phone number for call state not equal", USER_NUMBER, callStateResponse.getTo()); - assertEquals("From phone number for call state not equal", BW_NUMBER, callStateResponse.getFrom()); - assertEquals("Call ID not equal", createCallResponse.getCallId(), callStateResponse.getCallId()); - } catch (ApiException e) { - assertEquals("Response Code is not 404", 404, e.getResponseCode()); - }} - - - @Test - public void testCreateCallWithPriorityAndGetCallState() throws Exception { - final String answerUrl = BASE_CALLBACK_URL.concat("/callbacks/outbound"); - final Integer priority = 4; - - CreateCallRequest body = new CreateCallRequest.Builder() - .to(USER_NUMBER) - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .answerUrl(answerUrl) - .priority(priority) - .tag("the tag") - .build(); - - ApiResponse createCallApiResponse = controller.createCall(ACCOUNT_ID, body); - assertEquals("Response Code is not 201", 201, createCallApiResponse.getStatusCode()); - - CreateCallResponse createCallResponse = createCallApiResponse.getResult(); - assertNotNull("Call ID is null", createCallResponse.getCallId()); - assertFalse("Call ID is empty", createCallResponse.getCallId().isEmpty()); - assertEquals("Call ID is not 47 characters", 47, createCallResponse.getCallId().length()); - assertEquals("Application ID for create call not equal", VOICE_APPLICATION_ID, - createCallResponse.getApplicationId()); - assertEquals("To phone number for create call not equal", USER_NUMBER, createCallResponse.getTo()); - assertEquals("From phone number for create call not equal", BW_NUMBER, createCallResponse.getFrom()); - assertEquals("Priority is not equal", priority, createCallResponse.getPriority()); - assertEquals("Tag is missing", "the tag", createCallResponse.getTag()); - } - - @Test - public void testCreateCallInvalidPhoneNumber() throws Exception { - final String answerUrl = BASE_CALLBACK_URL.concat("/callbacks/outbound"); - - CreateCallRequest body = new CreateCallRequest.Builder() - .to("+1invalid") - .from(BW_NUMBER) - .applicationId(VOICE_APPLICATION_ID) - .answerUrl(answerUrl) - .build(); - - ApiErrorException e = assertThrows( - "ApiError Exception not thrown", - ApiErrorException.class, - () -> controller.createCall(ACCOUNT_ID, body)); - assertEquals("Response Code is not 400", 400, e.getResponseCode()); - } -} diff --git a/src/test/java/com/bandwidth/VoiceMachineDetectionConfigurationTest.java b/src/test/java/com/bandwidth/VoiceMachineDetectionConfigurationTest.java deleted file mode 100644 index 90f42258..00000000 --- a/src/test/java/com/bandwidth/VoiceMachineDetectionConfigurationTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.voice.models.CallbackMethodEnum; -import com.bandwidth.voice.models.FallbackMethodEnum; -import com.bandwidth.voice.models.MachineDetectionConfiguration; -import com.bandwidth.voice.models.ModeEnum; -import com.fasterxml.jackson.core.JsonProcessingException; -import org.junit.*; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -public class VoiceMachineDetectionConfigurationTest { - - @Test - public void testMachineDetectionConfigurationConstructor() { - MachineDetectionConfiguration machineDetectionConfiguration = new MachineDetectionConfiguration(ModeEnum.ASYNC, - 3.2, 5.6, 1.2, 7.6, false, - "https://www.example.com/", CallbackMethodEnum.GET, - "https://www.example-fallback.com/", FallbackMethodEnum.GET, - "neato-username", "neato-password", - "neato-username-fallback", "neato-password-fallback"); - - assertEquals(ModeEnum.ASYNC, machineDetectionConfiguration.getMode()); - assertEquals(Double.valueOf(3.2), machineDetectionConfiguration.getDetectionTimeout()); - assertEquals(Double.valueOf(5.6), machineDetectionConfiguration.getSilenceTimeout()); - assertEquals(Double.valueOf(1.2), machineDetectionConfiguration.getSpeechThreshold()); - assertEquals(Double.valueOf(7.6), machineDetectionConfiguration.getSpeechEndThreshold()); - assertFalse(machineDetectionConfiguration.getDelayResult()); - assertEquals("https://www.example.com/", machineDetectionConfiguration.getCallbackUrl()); - assertEquals(CallbackMethodEnum.GET, machineDetectionConfiguration.getCallbackMethod()); - assertEquals("https://www.example-fallback.com/", machineDetectionConfiguration.getFallbackUrl()); - assertEquals(FallbackMethodEnum.GET, machineDetectionConfiguration.getFallbackMethod()); - assertEquals("neato-username", machineDetectionConfiguration.getUsername()); - assertEquals("neato-password", machineDetectionConfiguration.getPassword()); - assertEquals("neato-username-fallback", machineDetectionConfiguration.getFallbackUsername()); - assertEquals("neato-password-fallback", machineDetectionConfiguration.getFallbackPassword()); - } - - @Test - public void testMachineDetectionConfigurationSerialize() throws JsonProcessingException { - MachineDetectionConfiguration machineDetectionConfiguration = new MachineDetectionConfiguration(ModeEnum.ASYNC, - 3.2, 5.6, 1.2, 7.6, false, - "https://www.example.com/", CallbackMethodEnum.GET, - "https://www.example-fallback.com/", FallbackMethodEnum.GET, - "neato-username", "neato-password", - "neato-username-fallback", "neato-password-fallback"); - - String json = ApiHelper.serialize(machineDetectionConfiguration); - assertEquals("{\"mode\":\"async\",\"detectionTimeout\":3.2,\"silenceTimeout\":5.6,\"speechThreshold\":1.2,\"speechEndThreshold\":7.6,\"delayResult\":false,\"callbackUrl\":\"https://www.example.com/\",\"callbackMethod\":\"GET\",\"fallbackUrl\":\"https://www.example-fallback.com/\",\"fallbackMethod\":\"GET\",\"username\":\"neato-username\",\"password\":\"neato-password\",\"fallbackUsername\":\"neato-username-fallback\",\"fallbackPassword\":\"neato-password-fallback\"}", json); - } -} diff --git a/src/test/java/com/bandwidth/WebRtcApiTest.java b/src/test/java/com/bandwidth/WebRtcApiTest.java deleted file mode 100644 index 0dfe1e8c..00000000 --- a/src/test/java/com/bandwidth/WebRtcApiTest.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.bandwidth; - -import com.bandwidth.http.response.ApiResponse; -import com.bandwidth.webrtc.controllers.APIController; - -import com.bandwidth.webrtc.models.*; - -import org.junit.*; - -import java.util.Arrays; -import java.util.HashSet; - -import static org.junit.Assert.*; - -import static com.bandwidth.TestingEnvironmentVariables.*; - -/* - * Integration tests between the SDK and WebRTC API - */ -public class WebRtcApiTest { - - private APIController controller; - - @Before - public void initTest(){ - BandwidthClient client = new BandwidthClient.Builder() - .webRtcBasicAuthCredentials(USERNAME, PASSWORD) - .build(); - - controller = client.getWebRtcClient().getAPIController(); - } - - // Break this into multiple tests when our test environment is more robust and there aren't dependency issues - @Test - public void testWebRtcParticipantSessionManagement() throws Exception { - // Create a participant - Participant participantCreationRequest = new Participant.Builder() - .callbackUrl(BASE_CALLBACK_URL + "/callbacks/webrtc") - .publishPermissions(Arrays.asList(PublishPermissionEnum.AUDIO, PublishPermissionEnum.VIDEO)) - .tag("test") - .deviceApiVersion(DeviceApiVersionEnum.V3) - .build(); - - ApiResponse participantCreationApiResponse = - controller.createParticipant(ACCOUNT_ID, participantCreationRequest); - assertEquals("Response Code is not 200", 200, participantCreationApiResponse.getStatusCode()); - - AccountsParticipantsResponse participantCreationResponse = participantCreationApiResponse.getResult(); - assertNotNull("Participant is null", participantCreationResponse.getParticipant()); - assertNotNull("Participant ID is null", participantCreationResponse.getParticipant().getId()); - assertFalse("Participant ID is empty", participantCreationResponse.getParticipant().getId().isEmpty()); - assertEquals("Participant ID is not 36 characters", 36, participantCreationResponse.getParticipant().getId().length()); - assertEquals( - "Publish Permissions do not match", - new HashSet<>(participantCreationRequest.getPublishPermissions()), - new HashSet<>(participantCreationResponse.getParticipant().getPublishPermissions()) - ); - assertEquals( - "Tags do not match", - participantCreationRequest.getTag(), - participantCreationResponse.getParticipant().getTag() - ); - assertEquals( - "DeviceApiVersions do not match", - participantCreationRequest.getDeviceApiVersion(), - participantCreationResponse.getParticipant().getDeviceApiVersion() - ); - assertNotNull("Token is null", participantCreationResponse.getToken()); - assertFalse("Token is empty", participantCreationResponse.getToken().isEmpty()); - - // Get a participant - ApiResponse participantFetchApiResponse = - controller.getParticipant(ACCOUNT_ID, participantCreationResponse.getParticipant().getId()); - assertEquals("Response Code is not 200", 200, participantFetchApiResponse.getStatusCode()); - - Participant participantFetchResponse = participantFetchApiResponse.getResult(); - assertNotNull("Participant is null", participantFetchResponse); - assertNotNull("Participant ID is null", participantFetchResponse.getId()); - assertFalse("Participant ID is empty", participantFetchResponse.getId().isEmpty()); - assertEquals("Participant ID is not 36 characters", 36, participantFetchResponse.getId().length()); - assertEquals( - "Publish Permissions do not match", - // convert the two lists to HashSets to ignore ordering - new HashSet<>(participantCreationResponse.getParticipant().getPublishPermissions()), - new HashSet<>(participantFetchResponse.getPublishPermissions()) - ); - assertEquals( - "Tags do not match", - participantCreationRequest.getTag(), - participantFetchResponse.getTag() - ); - assertEquals( - "DeviceApiVersions do not match", - participantCreationRequest.getDeviceApiVersion(), - participantFetchResponse.getDeviceApiVersion() - ); - - // Create a session - Session sessionCreationRequest = new Session.Builder() - .tag("test") - .build(); - - ApiResponse sessionCreationApiResponse = controller.createSession(ACCOUNT_ID, sessionCreationRequest); - assertEquals("Response Code is not 200", 200, sessionCreationApiResponse.getStatusCode()); - - Session sessionCreationResponse = sessionCreationApiResponse.getResult(); - assertNotNull("Session ID is null", sessionCreationResponse.getId()); - assertFalse("Session ID is empty", sessionCreationResponse.getId().isEmpty()); - assertEquals("Session ID is not 36 characters", 36, sessionCreationResponse.getId().length()); - assertEquals("Session Tags do not match", sessionCreationRequest.getTag(), sessionCreationResponse.getTag()); - - // Get a session - ApiResponse sessionFetchApiResponse = controller.getSession(ACCOUNT_ID, sessionCreationResponse.getId()); - assertEquals("Response Code is not 200", 200, sessionFetchApiResponse.getStatusCode()); - - Session sessionFetchResponse = sessionFetchApiResponse.getResult(); - assertEquals("Session IDs do not match", sessionCreationResponse.getId(), sessionFetchResponse.getId()); - assertEquals("Session Tags do not match", sessionCreationResponse.getTag(), sessionFetchResponse.getTag()); - - // Add a participant to a session - ApiResponse addParticipantApiResponse = - controller.addParticipantToSession(ACCOUNT_ID, sessionCreationResponse.getId(), participantCreationResponse.getParticipant().getId(), null); - assertEquals("Response Code is not 204", 204, addParticipantApiResponse.getStatusCode()); - - // Get session participants - /* Service currently broken - uncomment once it sends a proper response - ApiResponse> sessionParticipantFetchApiResponse = - controller.listSessionParticipants(ACCOUNT_ID, sessionCreationResponse.getId()); - assertEquals("Response Code is not 200", 200, sessionParticipantFetchApiResponse.getStatusCode()); - - java.util.List sessionParticipantFetchResponse = sessionParticipantFetchApiResponse.getResult(); - assertFalse("List of Participants is empty", sessionParticipantFetchResponse.isEmpty()); - assertEquals("List of Participants should only contain a single item", 1, sessionParticipantFetchResponse.size()); - assertEquals( - "Participant IDs do not match", - participantCreationResponse.getParticipant().getId(), - sessionParticipantFetchResponse.get(0).getId() - ); - // This functionality hasn't been implemented yet, so Callback URLs aren't stored and null is returned - assertEquals( - "Callback URLs do not match", - participantCreationRequest.getCallbackUrl(), - sessionParticipantFetchResponse.get(0).getCallbackUrl() - ); - assertEquals( - "Publish Permissions do not match", - new HashSet<>(participantCreationResponse.getParticipant().getPublishPermissions()), - new HashSet<>(sessionParticipantFetchResponse.get(0).getPublishPermissions()) - ); - assertEquals( - "Tags do not match", - participantCreationRequest.getTag(), - sessionParticipantFetchResponse.get(0).getTag() - ); - assertEquals( - "Device API Versions do not match", - participantCreationRequest.getDeviceApiVersion(), - sessionParticipantFetchResponse.get(0).getDeviceApiVersion() - ); - */ - - // Remove session participant - ApiResponse removeSessionParticipantApiResponse = - controller.removeParticipantFromSession( - ACCOUNT_ID, - sessionCreationResponse.getId(), - participantCreationResponse.getParticipant().getId() - ); - assertEquals("Response Code is not 204", 204, removeSessionParticipantApiResponse.getStatusCode()); - - // Delete session - ApiResponse deleteSessionApiResponse = - controller.deleteSession(ACCOUNT_ID, sessionCreationResponse.getId()); - assertEquals("Response Code is not 204", 204, deleteSessionApiResponse.getStatusCode()); - - // Delete participant - ApiResponse deleteParticipantApiResponse = - controller.deleteParticipant(ACCOUNT_ID, participantCreationResponse.getParticipant().getId()); - assertEquals("Response Code is not 204", 204, deleteParticipantApiResponse.getStatusCode()); - } -} diff --git a/src/test/java/com/bandwidth/sdk/api/CallsApiTest.java b/src/test/java/com/bandwidth/sdk/api/CallsApiTest.java new file mode 100644 index 00000000..3da759b9 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/CallsApiTest.java @@ -0,0 +1,400 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.CreateCall; +import com.bandwidth.sdk.model.CreateCallResponse; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.CallState; +import com.bandwidth.sdk.model.CallStateEnum; +import com.bandwidth.sdk.model.MachineDetectionConfiguration; +import com.bandwidth.sdk.model.MachineDetectionModeEnum; +import com.bandwidth.sdk.model.UpdateCall; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.Assertions; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.beans.HasPropertyWithValue.hasProperty; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; +import static com.bandwidth.sdk.utils.CallCleanup.Cleanup; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class CallsApiTest { + public ApiClient defaultClient = Configuration.getDefaultApiClient(); + public HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + public final CallsApi api = new CallsApi(defaultClient); + + private static List callIdList = new ArrayList(); + private static MachineDetectionConfiguration machineDetection = new MachineDetectionConfiguration(); + private static CreateCall createCallBody = new CreateCall(); + private static CreateCall createMantecaCallBody = new CreateCall(); + private static UpdateCall updateMantecaCallBody = new UpdateCall(); + private static UpdateCall completeMantecaCallBody = new UpdateCall(); + private static URI answerUrl; + private static URI mantecaAnswerUrl; + private static URI mantecaRedirectUrl; + private static URI fallbackUrl; + private static URI disconnectUrl; + private static URI machineDetectionUrl; + private static URI machineDetectionCompleteUrl; + private static CallbackMethodEnum callbackMethod = CallbackMethodEnum.POST; + private static String testCallId = "Call-Id"; + private static String testXmlBody = "This is a test bxml response"; + private static int TEST_SLEEP = 3; + + @BeforeAll + public static void setupBeforeClass() throws URISyntaxException { + answerUrl = new URI(BASE_CALLBACK_URL); + mantecaAnswerUrl = new URI(MANTECA_BASE_URL + "/bxml/pause"); + mantecaRedirectUrl = new URI(MANTECA_BASE_URL + "/bxml/pause"); + fallbackUrl = new URI("https://www.myFallbackServer.com/webhooks/answer"); + disconnectUrl = new URI("https://myServer.com/bandwidth/webhooks/disconnectUrl"); + machineDetectionUrl = new URI("https://myServer.com/bandwidth/webhooks/machineDetectionComplete"); + machineDetectionCompleteUrl = new URI( + "https://myFallbackServer.com/bandwidth/webhooks/machineDetectionComplete"); + + machineDetection.setMode(MachineDetectionModeEnum.ASYNC); + machineDetection.setDetectionTimeout(15.0); + machineDetection.setSilenceTimeout(10.0); + machineDetection.setSpeechThreshold(10.0); + machineDetection.setSpeechEndThreshold(5.0); + machineDetection.setMachineSpeechEndThreshold(5.0); + machineDetection.setDelayResult(false); + machineDetection.setCallbackUrl(machineDetectionUrl); + machineDetection.setCallbackMethod(callbackMethod); + machineDetection.setUsername("mySecretUsername"); + machineDetection.setPassword("mySecretPassword1!"); + machineDetection.setFallbackUrl(machineDetectionCompleteUrl); + machineDetection.setFallbackMethod(callbackMethod); + machineDetection.setFallbackUsername("mySecretUsername"); + machineDetection.setFallbackPassword("mySecretPassword1!"); + + createCallBody.setTo(USER_NUMBER); + createCallBody.setFrom(BW_NUMBER); + createCallBody.setApplicationId(BW_VOICE_APPLICATION_ID); + createCallBody.setAnswerUrl(answerUrl); + createCallBody.setAnswerMethod(callbackMethod); + createCallBody.setUsername("mySecretUsername"); + createCallBody.setPassword("mySecretPassword1!"); + createCallBody.setAnswerFallbackUrl(fallbackUrl); + createCallBody.setAnswerFallbackMethod(callbackMethod); + createCallBody.setFallbackUsername("mySecretUsername"); + createCallBody.setFallbackPassword("mySecretPassword1!"); + createCallBody.setDisconnectUrl(disconnectUrl); + createCallBody.setDisconnectMethod(callbackMethod); + createCallBody.setCallTimeout(30.0); + createCallBody.setCallbackTimeout(15.0); + createCallBody.setMachineDetection(machineDetection); + createCallBody.setPriority(5); + createCallBody.setTag("tag_example"); + + createMantecaCallBody.setFrom(MANTECA_ACTIVE_NUMBER); + createMantecaCallBody.setTo(MANTECA_IDLE_NUMBER); + createMantecaCallBody.setApplicationId(MANTECA_APPLICATION_ID); + createMantecaCallBody.setAnswerUrl(mantecaAnswerUrl); + + updateMantecaCallBody.setState(CallStateEnum.ACTIVE); + updateMantecaCallBody.setRedirectUrl(mantecaRedirectUrl); + + completeMantecaCallBody.setState(CallStateEnum.COMPLETED); + } + + @AfterAll + public void tearDownAfterClass() throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + Cleanup(this, callIdList); + } + + @Test + @Order(1) + public void createCall() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse response = api.createCallWithHttpInfo(BW_ACCOUNT_ID, createCallBody); + callIdList.add(response.getData().getCallId()); + + assertThat(response.getStatusCode(), is(201)); + assertThat(response.getData(), hasProperty("callId", is(instanceOf(String.class)))); + assertThat(response.getData(), hasProperty("accountId", is(BW_ACCOUNT_ID))); + assertThat(response.getData(), hasProperty("applicationId", is(BW_VOICE_APPLICATION_ID))); + assertThat(response.getData(), hasProperty("to", is(USER_NUMBER))); + assertThat(response.getData(), hasProperty("from", is(BW_NUMBER))); + } + + @Test + public void createCallBadRequest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + CreateCall badCallRequest = new CreateCall(); + createCallBody.setTo("invalid_number"); + createCallBody.setFrom(BW_NUMBER); + createCallBody.setApplicationId(BW_VOICE_APPLICATION_ID); + createCallBody.setAnswerUrl(answerUrl); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createCallWithHttpInfo(BW_ACCOUNT_ID, badCallRequest)); + + assertThat(exception.getCode(), is(400)); + } + + @Test + public void createCallUnauthorized() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + CreateCall badCallRequest = new CreateCall(); + createCallBody.setTo("invalid_number"); + createCallBody.setFrom(BW_NUMBER); + createCallBody.setApplicationId(BW_VOICE_APPLICATION_ID); + createCallBody.setAnswerUrl(answerUrl); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createCallWithHttpInfo(BW_ACCOUNT_ID, badCallRequest)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void createCallForbidden() throws ApiException { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + CreateCall badCallRequest = new CreateCall(); + createCallBody.setTo("invalid_number"); + createCallBody.setFrom(BW_NUMBER); + createCallBody.setApplicationId(BW_VOICE_APPLICATION_ID); + createCallBody.setAnswerUrl(answerUrl); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createCallWithHttpInfo(BW_ACCOUNT_ID, badCallRequest)); + + assertThat(exception.getCode(), is(403)); + } + + // @Test + // @Order(2) + // public void getCallState() throws ApiException, InterruptedException { + // Basic.setUsername(BW_USERNAME); + // Basic.setPassword(BW_PASSWORD); + + // TimeUnit.SECONDS.sleep(TEST_SLEEP); + // ApiResponse response = api.getCallStateWithHttpInfo(BW_ACCOUNT_ID, callIdList.get(0)); + + // assertThat(response.getStatusCode(), anyOf(is(200),is(404))); + // assertThat(response.getData(), hasProperty("callId", is(instanceOf(String.class)))); + // assertThat(response.getData(), hasProperty("state", is(instanceOf(String.class)))); + // assertThat(response.getData(), hasProperty("direction", is(CallDirectionEnum.OUTBOUND))); + // } + + @Test + public void getCallStateUnauthorized() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.getCallStateWithHttpInfo(BW_ACCOUNT_ID, "not a call id")); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void getCallStateForbidden() throws ApiException { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.getCallStateWithHttpInfo(BW_ACCOUNT_ID, "not a call id")); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void getCallStateNotFound() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.getCallStateWithHttpInfo(BW_ACCOUNT_ID, "not a call id")); + + assertThat(exception.getCode(), is(404)); + } + + @Test + @Order(3) + public void updateCall() throws ApiException, InterruptedException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + // Create call + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse createCallResponse = api.createCallWithHttpInfo(BW_ACCOUNT_ID, + createMantecaCallBody); + callIdList.add(createCallResponse.getData().getCallId()); + + assertThat(createCallResponse.getStatusCode(), is(201)); + + // Redirect call to different url + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse updateCallResponse = api.updateCallWithHttpInfo(BW_ACCOUNT_ID, + createCallResponse.getData().getCallId(), updateMantecaCallBody); + + assertThat(updateCallResponse.getStatusCode(), is(200)); + + // Complete call + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse completeCallResponse = api.updateCallWithHttpInfo(BW_ACCOUNT_ID, + createCallResponse.getData().getCallId(), completeMantecaCallBody); + + assertThat(completeCallResponse.getStatusCode(), is(200)); + } + + @Test + public void updateCallBadRequest() throws ApiException, InterruptedException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + UpdateCall badRequest = new UpdateCall(); + badRequest.state(null); + + // Create call + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse createCallResponse = api.createCallWithHttpInfo(BW_ACCOUNT_ID, + createMantecaCallBody); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallWithHttpInfo(BW_ACCOUNT_ID, createCallResponse.getData().getCallId(), + badRequest)); + + assertThat(exception.getCode(), is(400)); + } + + @Test + public void updateCallUnauthorized() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallWithHttpInfo(BW_ACCOUNT_ID, testCallId, + new UpdateCall().state(CallStateEnum.COMPLETED))); + + assertThat(exception.getCode(), is(401)); + + } + + @Test + public void updateCallForbidden() throws ApiException { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallWithHttpInfo(BW_ACCOUNT_ID, testCallId, + new UpdateCall().state(CallStateEnum.COMPLETED))); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void updateCallNotFound() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallWithHttpInfo(BW_ACCOUNT_ID, testCallId, + new UpdateCall().state(CallStateEnum.COMPLETED))); + + assertThat(exception.getCode(), is(404)); + } + + @Test + @Order(4) + public void updateCallBxml() throws ApiException, InterruptedException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + // Create call + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse createCallResponse = api.createCallWithHttpInfo(BW_ACCOUNT_ID, + createMantecaCallBody); + callIdList.add(createCallResponse.getData().getCallId()); + + assertThat(createCallResponse.getStatusCode(), is(201)); + + // Redirect call to different url + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse updateCallResponse = api.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID, + createCallResponse.getData().getCallId(), testXmlBody); + + assertThat(updateCallResponse.getStatusCode(), is(204)); + + // Complete call + TimeUnit.SECONDS.sleep(TEST_SLEEP); + ApiResponse completeCallResponse = api.updateCallWithHttpInfo(BW_ACCOUNT_ID, + createCallResponse.getData().getCallId(), completeMantecaCallBody); + + assertThat(completeCallResponse.getStatusCode(), is(200)); + } + + @Test + public void updateCallBxmlBadRequest() throws ApiException { + + } + + @Test + public void updateCallBxmlUnauthorized() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID, testCallId, + testXmlBody)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void updateCallBxmlForbidden() throws ApiException { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID, testCallId, + testXmlBody)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void updateCallBxmlNotFound() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.updateCallBxmlWithHttpInfo(BW_ACCOUNT_ID, testCallId, + testXmlBody)); + + assertThat(exception.getCode(), is(404)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/ConferencesApiTest.java b/src/test/java/com/bandwidth/sdk/api/ConferencesApiTest.java new file mode 100644 index 00000000..0d68f757 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/ConferencesApiTest.java @@ -0,0 +1,235 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.model.ConferenceRecordingMetadata; +import com.bandwidth.sdk.model.ConferenceStateEnum; +import com.bandwidth.sdk.model.CreateCall; +import com.bandwidth.sdk.model.CreateCallResponse; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.bandwidth.sdk.model.Conference; +import com.bandwidth.sdk.model.ConferenceMember; +import com.bandwidth.sdk.model.RedirectMethodEnum; +import com.bandwidth.sdk.model.UpdateConference; +import com.bandwidth.sdk.model.UpdateConferenceMember; +import com.bandwidth.sdk.utils.MantecaStatusResponse; + +import com.google.gson.Gson; + +import okhttp3.Call; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; +import static com.bandwidth.sdk.utils.CallCleanup.Cleanup; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class ConferencesApiTest { + public ApiClient defaultClient = Configuration.getDefaultApiClient(); + public HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + public final CallsApi callsApi = new CallsApi(defaultClient); + public final ConferencesApi conferencesApi = new ConferencesApi(defaultClient); + + private static final OkHttpClient mantecaClient = new OkHttpClient(); + public static final MediaType jsonMediaType = MediaType.get("application/json; charset=utf-8"); + + private static String testId; + private static String callId; + private static String conferenceId; + private static URI answerUrl; + private static URI conferenceRedirectUrl; + private static String updateRecordingBxml = "This should be a conference recording."; + private static int TEST_SLEEP = 3; + private static int MAX_RETRIES = 40; + + @BeforeAll + public static void setUpBeforeClass() throws URISyntaxException { + answerUrl = new URI(MANTECA_BASE_URL + "/bxml/joinConferencePause"); + conferenceRedirectUrl = new URI(MANTECA_BASE_URL + "/bxml/pause"); + } + + @AfterAll + public void tearDownAfterClass() throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + Cleanup(this, callId); + } + + static final String constructMantecaJsonBody(String os, String language) { + return "{\"os\": \"" + os + "\", \"language\":\"JAVA" + JAVA_VERSION + "\", \"type\":\"conference\"}"; + } + + public void validateRecording(ConferenceRecordingMetadata recording, String conferenceId) { + + } + + public Boolean getTestRecordedStatus(String mantecaTestId) throws Exception { + try { + // Setup the test with Manteca + Request mantecaStatusRequest = new Request.Builder() + .url(MANTECA_STATUS_URL + mantecaTestId) + .build(); + Call mantecaStatusApiCall = mantecaClient.newCall(mantecaStatusRequest); + Response mantecaStatusResponse = mantecaStatusApiCall.execute(); + + Gson gson = new Gson(); + MantecaStatusResponse mantecaStatus = gson.fromJson( + mantecaStatusResponse.peekBody(2048).string(), + MantecaStatusResponse.class); + if (mantecaStatusResponse.isSuccessful()) { + return mantecaStatus.callRecorded; + } else { + System.out.println(mantecaStatusResponse.body().string()); + throw new Exception( + "Received HTTP " + String.valueOf(mantecaStatusResponse.code()) + " status code from Manteca"); + } + } catch (IOException e) { + System.out.println(e.toString()); + throw new Exception("Failed to get test status from Manteca, aborting test run :("); + } + } + + @Test + @Order(1) + public void testCreateAndFetchConference() throws Exception { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + String mantecaJsonBody = constructMantecaJsonBody(OPERATING_SYSTEM, JAVA_VERSION); + RequestBody mantecaRequestBody = RequestBody.create(mantecaJsonBody, jsonMediaType); + + try { + // Setup the test with Manteca + Request mantecaRequest = new Request.Builder() + .url(MANTECA_BASE_URL + "/tests") + .post(mantecaRequestBody) + .build(); + Call mantecaApiCall = mantecaClient.newCall(mantecaRequest); + testId = mantecaApiCall.execute().body().string(); + } catch (IOException e) { + System.out.println(e.toString()); + throw new Exception("Failed to initialize conference tests with Manteca, aborting test run :("); + } + + CreateCall conferenceCallBody = new CreateCall(); + conferenceCallBody.setTo(MANTECA_IDLE_NUMBER); + conferenceCallBody.setFrom(MANTECA_ACTIVE_NUMBER); + conferenceCallBody.setApplicationId(MANTECA_APPLICATION_ID); + conferenceCallBody.setAnswerUrl(answerUrl); + conferenceCallBody.setTag(testId); + + ApiResponse createCallResponse = callsApi.createCallWithHttpInfo(BW_ACCOUNT_ID, + conferenceCallBody); + + assertThat(createCallResponse.getStatusCode(), is(201)); + callId = createCallResponse.getData().getCallId(); + + // TODO: Remove after successful test in GHA runners + System.out.println("TestId: " + testId); + System.out.println("CallId: " + callId); + + TimeUnit.SECONDS.sleep(TEST_SLEEP); + + ApiResponse> listConferencesResponse = conferencesApi + .listConferencesWithHttpInfo(BW_ACCOUNT_ID, testId, null, null, null, null); + assertThat(listConferencesResponse.getStatusCode(), is(200)); + + conferenceId = listConferencesResponse.getData().get(0).getId(); + + ApiResponse getConferenceResponse = conferencesApi.getConferenceWithHttpInfo(BW_ACCOUNT_ID, + conferenceId); + assertThat(getConferenceResponse.getStatusCode(), is(200)); + + } + + @Test + @Order(2) + public void testConferenceAndMembers() throws Exception { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse listConferenceMembersResponse = conferencesApi + .getConferenceMemberWithHttpInfo(BW_ACCOUNT_ID, conferenceId, callId); + assertThat(listConferenceMembersResponse.getStatusCode(), is(200)); + + UpdateConferenceMember updateMember = new UpdateConferenceMember(); + updateMember.setMute(false); + + ApiResponse updateConferenceMemberResponse = conferencesApi + .updateConferenceMemberWithHttpInfo(BW_ACCOUNT_ID, conferenceId, callId, updateMember); + assertThat(updateConferenceMemberResponse.getStatusCode(), is(204)); + + UpdateConference updateConference = new UpdateConference(); + updateConference.setStatus(ConferenceStateEnum.ACTIVE); + updateConference.setRedirectUrl(conferenceRedirectUrl); + updateConference.setRedirectMethod(RedirectMethodEnum.POST); + updateConference.setUsername("myUsername"); + updateConference.setPassword("myPassword1!"); + updateConference.setRedirectFallbackUrl(conferenceRedirectUrl); + updateConference.setRedirectFallbackMethod(RedirectMethodEnum.POST); + updateConference.setFallbackUsername("myUsername"); + updateConference.setFallbackPassword("myPassword1!"); + + ApiResponse updateConferenceResponse = conferencesApi.updateConferenceWithHttpInfo(BW_ACCOUNT_ID, + conferenceId, updateConference); + assertThat(updateConferenceResponse.getStatusCode(), is(204)); + + ApiResponse updateConferenceBxmlResponse = conferencesApi.updateConferenceBxmlWithHttpInfo(BW_ACCOUNT_ID, + conferenceId, updateRecordingBxml); + assertThat(updateConferenceBxmlResponse.getStatusCode(), is(204)); + } + + @Test + @Order(3) + public void testConferenceRecordings() throws Exception { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + Boolean testRecordingStatus = false; + for (int i = 0; i < MAX_RETRIES; i++) { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + testRecordingStatus = getTestRecordedStatus(testId); + } + assertThat(testRecordingStatus, is(true)); + + ApiResponse> listConferenceRecordingsResponse = conferencesApi + .listConferenceRecordingsWithHttpInfo(BW_ACCOUNT_ID, conferenceId); + assertThat(listConferenceRecordingsResponse.getStatusCode(), is(200)); + + ConferenceRecordingMetadata conferenceRecording = listConferenceRecordingsResponse.getData().get(0); + + ApiResponse conferenceRecordingMetadataResponse = conferencesApi + .getConferenceRecordingWithHttpInfo(BW_ACCOUNT_ID, conferenceId, + conferenceRecording.getRecordingId()); + assertThat(conferenceRecordingMetadataResponse.getStatusCode(), is(200)); + assertThat(conferenceRecordingMetadataResponse.getData().getStatus(), is("complete")); + assertThat(conferenceRecordingMetadataResponse.getData().getFileFormat(), is(FileFormatEnum.WAV)); + + ApiResponse downloadRecordingResponse = conferencesApi.downloadConferenceRecordingWithHttpInfo( + BW_ACCOUNT_ID, conferenceId, + conferenceRecording.getRecordingId()); + assertThat(downloadRecordingResponse.getStatusCode(), is(200)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java new file mode 100644 index 00000000..710a81a2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/MediaApiTest.java @@ -0,0 +1,90 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.model.Media; +import com.bandwidth.sdk.Configuration; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.MethodOrderer.OrderAnnotation; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.UUID; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +@TestMethodOrder(OrderAnnotation.class) +public class MediaApiTest { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + private final MediaApi api = new MediaApi(defaultClient); + + private static String mediaPath = "src/test/java/com/bandwidth/sdk/fixtures/"; + private static String mediaFile = "java_cat.jpeg"; + private static String mediaId; + private static UUID uuid; + private static File media = new File(mediaPath + mediaFile); + private static String contentType = "image/jpeg"; + private static String cacheControl = "no-cache"; + + @BeforeAll + public static void setupBeforeClass() { + uuid = UUID.randomUUID(); + mediaId = JAVA_VERSION + "_" + RUNNER_OS + "_" + uuid + "_" + mediaFile; + } + + @Test + @Order(1) + public void uploadMedia() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse response = api.uploadMediaWithHttpInfo(BW_ACCOUNT_ID, mediaId, media, + contentType, + cacheControl); + + assertThat(response.getStatusCode(), is(204)); + } + + @Test + @Order(2) + public void listMedia() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + ApiResponse> response = api.listMediaWithHttpInfo(BW_ACCOUNT_ID, null); + + assertThat(response.getStatusCode(), is(200)); + } + + @Test + @Order(3) + public void getMedia() throws ApiException, IOException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse response = api.getMediaWithHttpInfo(BW_ACCOUNT_ID, mediaId); + + assertThat(response.getStatusCode(), is(200)); + assertThat(FileUtils.readLines(response.getData(), "utf-8"), is(FileUtils.readLines(media, "utf-8"))); + } + + @Test + @Order(4) + public void deleteMedia() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse response = api.deleteMediaWithHttpInfo(BW_ACCOUNT_ID, mediaId); + assertThat(response.getStatusCode(), is(204)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/MessagesApiTest.java b/src/test/java/com/bandwidth/sdk/api/MessagesApiTest.java new file mode 100644 index 00000000..37dae6aa --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/MessagesApiTest.java @@ -0,0 +1,186 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + */ + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.model.ListMessageDirectionEnum; +import com.bandwidth.sdk.model.ListMessageItem; +import com.bandwidth.sdk.model.Message; +import com.bandwidth.sdk.model.MessageRequest; +import com.bandwidth.sdk.model.MessageStatusEnum; +import com.bandwidth.sdk.model.MessageTypeEnum; +import com.bandwidth.sdk.model.MessagesList; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.net.URI; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.matchesRegex; +import static org.hamcrest.Matchers.contains; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +/** + * API tests for MessagesApi + */ +public class MessagesApiTest { + + ApiClient defaultClient = Configuration.getDefaultApiClient(); + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + private final MessagesApi api = new MessagesApi(defaultClient); + + // Setting up variables + String accountId = BW_ACCOUNT_ID; + String messageId = null; + String sourceTn = null; + String destinationTn = null; + MessageStatusEnum messageStatus = null; + ListMessageDirectionEnum messageDirection = null; + String carrierName = null; + MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms"); + Integer errorCode = null; + String fromDateTime = null; + String toDateTime = null; + String campaignId = null; + String sort = "sourceTn:desc"; + String pageToken = null; + Integer limit = 50; + + String applicationId = (BW_MESSAGING_APPLICATION_ID); + + public MessageRequest messageRequest = new MessageRequest(); + + /** + * List Messages + * + * Returns a list of messages based on query parameters. + * + * @throws ApiException if the Api call fails + */ + + @Test + public void listMessagesTest() throws ApiException { + + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + MessagesList response = api.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, + messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, + limit, false); + + assertThat(response, instanceOf(MessagesList.class)); + assertThat(response.getTotalCount(), greaterThan(0)); + + ListMessageItem message = response.getMessages().get(0); + assertThat(message, instanceOf(ListMessageItem.class)); + assertThat(message.getAccountId(), is(System.getenv("BW_ACCOUNT_ID"))); + assertThat(message.getDestinationTn(), matchesRegex("^\\+[1-9]\\d{1,14}$")); + assertThat(message.getMessageDirection(), instanceOf(ListMessageDirectionEnum.class)); + assertThat(message.getMessageId(), matchesRegex("^.+$")); + assertThat(message.getMessageStatus(), instanceOf(MessageStatusEnum.class)); + assertThat(message.getMessageType(), instanceOf(MessageTypeEnum.class)); + assertThat(message.getSegmentCount(), greaterThan(0)); + } + + @Test + public void listMessageBadRequestTest() { + + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + String pageToken = "gdEewhcJLQRB5"; // Bad Token + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, + carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, false)); + assertThat(exception.getCode(), is(400)); + + } + + @Test + public void listMessageUnauthorizedTest() { + + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, + carrierName, messageType, errorCode, fromDateTime, toDateTime, campaignId, sort, pageToken, limit, false)); + assertThat(exception.getCode(), is(401)); + } + + /** + * Create Message + * + * Endpoint for sending text messages and picture messages using V2 messaging. + * + * @throws ApiException if the Api call fails + */ + + @Test + public void createMessageTest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + messageRequest.applicationId(applicationId); + messageRequest.addToItem(USER_NUMBER); + messageRequest.from(BW_NUMBER); + messageRequest.text("Sample Text"); + messageRequest.addMediaItem(URI.create("https://cdn2.thecatapi.com/images/MTY3ODIyMQ.jpg")); + messageRequest.tag("Java Integration Test"); + messageRequest.priority(PriorityEnum.DEFAULT); + Message response = api.createMessage(accountId, messageRequest); + + assertThat(response, instanceOf(Message.class)); + assertThat(response.getFrom(), is(System.getenv("BW_NUMBER"))); + assertThat(response.getTo(), contains(System.getenv("USER_NUMBER"))); + assertThat(response.getApplicationId(), is(System.getenv("BW_MESSAGING_APPLICATION_ID"))); + assertThat(response.getText(), is("Sample Text")); + assertThat(response.getTag(), is("Java Integration Test")); + assertThat(response.getMedia(), contains("https://cdn2.thecatapi.com/images/MTY3ODIyMQ.jpg")); + assertThat(response.getPriority(), instanceOf(PriorityEnum.class)); + assertThat(response.getSegmentCount(), greaterThan(0)); + } + + @Test + public void createMessageBadRequestTest() { + + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + messageRequest.applicationId(null); + messageRequest.addToItem(USER_NUMBER); + messageRequest.from(BW_NUMBER); + messageRequest.text("Sample Text"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createMessage(accountId, messageRequest)); + assertThat(exception.getCode(), is(400)); + } + + @Test + public void createMessageUnauthorizedTest() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + messageRequest.applicationId(BW_MESSAGING_APPLICATION_ID); + messageRequest.addToItem(USER_NUMBER); + messageRequest.from(BW_NUMBER); + messageRequest.text("Sample Text"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createMessage(accountId, messageRequest)); + assertThat(exception.getCode(), is(401)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/MfaApiTest.java b/src/test/java/com/bandwidth/sdk/api/MfaApiTest.java new file mode 100644 index 00000000..f8533805 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/MfaApiTest.java @@ -0,0 +1,151 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.model.CodeRequest; +import com.bandwidth.sdk.model.MessagingCodeResponse; +import com.bandwidth.sdk.model.VerifyCodeRequest; +import com.bandwidth.sdk.model.VerifyCodeResponse; +import com.bandwidth.sdk.model.VoiceCodeResponse; +import com.bandwidth.sdk.Configuration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; +import java.util.concurrent.ThreadLocalRandom; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.is; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +public class MfaApiTest { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + private final MfaApi api = new MfaApi(defaultClient); + + @Test + public void successfulMfaGenerateMessagingCodeRequest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + CodeRequest request = new CodeRequest(); + request.setTo(USER_NUMBER); + request.setFrom(BW_NUMBER); + request.setApplicationId(BW_MESSAGING_APPLICATION_ID); + request.setScope("scope"); + request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}"); + request.setDigits(6); + ApiResponse response = api.generateMessagingCodeWithHttpInfo(BW_ACCOUNT_ID, request); + assertThat(response.getStatusCode(), is(200)); + + assertThat(response.getData(), instanceOf(MessagingCodeResponse.class)); + } + + @Test + public void successfulMfaGenerateVoiceCodeRequest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + CodeRequest request = new CodeRequest(); + request.setTo(USER_NUMBER); + request.setFrom(BW_NUMBER); + request.setApplicationId(BW_VOICE_APPLICATION_ID); + request.setScope("scope"); + request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}"); + request.setDigits(6); + ApiResponse response = api.generateVoiceCodeWithHttpInfo(BW_ACCOUNT_ID, request); + assertThat(response.getStatusCode(), is(200)); + + assertThat(response.getData(), instanceOf(VoiceCodeResponse.class)); + } + + @Test + public void successfulMfaVerifyCodeRequest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + BigDecimal expirationTime = new BigDecimal(3); + + // Generate a random TN for the setTo - otherwise we get heavily rate limited + Long minTn = 1111111111L; + Long maxTn = 9999999999L; + Long randomInt = ThreadLocalRandom.current().nextLong(maxTn - minTn) + minTn; + + VerifyCodeRequest request = new VerifyCodeRequest(); + request.setTo("+1" + randomInt.toString()); + request.setScope("2FA"); + request.setExpirationTimeInMinutes(expirationTime); + request.setCode("123456"); + + ApiResponse response = api.verifyCodeWithHttpInfo(BW_ACCOUNT_ID, request); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData().getValid(), is(false)); + } + + @Test + public void badRequest() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + CodeRequest badRequest = new CodeRequest(); + badRequest.setTo(USER_NUMBER); + badRequest.setFrom(BW_NUMBER); + badRequest.setApplicationId("not_an_application_id"); + badRequest.setScope("scope"); + badRequest.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}"); + badRequest.setDigits(6); + + ApiException messagingException = Assertions.assertThrows(ApiException.class, + () -> api.generateMessagingCodeWithHttpInfo(BW_ACCOUNT_ID, + badRequest)); + assertThat(messagingException.getCode(), is(400)); + + ApiException voiceException = Assertions.assertThrows(ApiException.class, + () -> api.generateVoiceCodeWithHttpInfo(BW_ACCOUNT_ID, + badRequest)); + assertThat(voiceException.getCode(), is(400)); + } + + @Test + public void unauthorizedRequest() throws ApiException { + Basic.setUsername(null); + Basic.setPassword(null); + + CodeRequest request = new CodeRequest(); + request.setTo(USER_NUMBER); + request.setFrom(BW_NUMBER); + request.setApplicationId(BW_VOICE_APPLICATION_ID); + request.setScope("scope"); + request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}"); + request.setDigits(6); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.generateMessagingCodeWithHttpInfo(BW_ACCOUNT_ID, + request)); + assertThat(exception.getCode(), is(401)); + } + + @Test + public void forbiddenRequest() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword("bad_password"); + + CodeRequest request = new CodeRequest(); + request.setTo(USER_NUMBER); + request.setFrom(BW_NUMBER); + request.setApplicationId(BW_MESSAGING_APPLICATION_ID); + request.setScope("scope"); + request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}"); + request.setDigits(6); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.generateMessagingCodeWithHttpInfo(BW_ACCOUNT_ID, + request)); + assertThat(exception.getCode(), is(403)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/api/PhoneNumberLookupApiTest.java b/src/test/java/com/bandwidth/sdk/api/PhoneNumberLookupApiTest.java new file mode 100644 index 00000000..4a15caf6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/PhoneNumberLookupApiTest.java @@ -0,0 +1,185 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.model.LookupRequest; +import com.bandwidth.sdk.model.LookupStatus; +import com.bandwidth.sdk.model.LookupStatusEnum; +import com.bandwidth.sdk.model.CreateLookupResponse; +import com.bandwidth.sdk.model.LookupResult; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.matchesRegex; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +public class PhoneNumberLookupApiTest { + + ApiClient defaultClient = Configuration.getDefaultApiClient(); + HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + private final PhoneNumberLookupApi api = new PhoneNumberLookupApi(defaultClient); + LookupRequest lookupRequest = new LookupRequest(); + + /** + * Validate a LookupResult object + * + * @param result A LookupResult object + * @param phoneNumber A String phone number in E164 format to check against the + * E164 format value in the result + */ + private void validateResult(LookupResult result, String phoneNumber) { + if (result.getMobileCountryCode() != null || result.getMobileNetworkCode() != null) { + assertThat(result.getMobileCountryCode(), instanceOf(String.class)); + assertThat(result.getMobileNetworkCode(), instanceOf(String.class)); + } + + assertThat(result, hasProperty("responseCode")); + assertThat(result, hasProperty("message")); + assertThat(result, hasProperty("e164Format")); + assertThat(result, hasProperty("formatted")); + assertThat(result, hasProperty("country")); + assertThat(result, hasProperty("lineType")); + assertThat(result, hasProperty("lineProvider")); + assertThat(result, hasProperty("mobileCountryCode")); + assertThat(result, hasProperty("mobileNetworkCode")); + + assertThat(result.getE164Format(), is(phoneNumber)); + } + + /** + * Poll for a completed TN Lookup order + * + * @param requestId String requestId to poll for + * @return the completed lookup status + * @throws Exception If status was not complete after 5 attempts + */ + private LookupStatus pollLookupStatus(String requestId) throws Exception { + int attempt = 1; + LookupStatus lookupStatus = this.api.getLookupStatus(BW_ACCOUNT_ID, requestId); + + do { + try { + lookupStatus = this.api.getLookupStatus(BW_ACCOUNT_ID, requestId); + TimeUnit.SECONDS.sleep(2); + attempt += 1; + } catch (ApiException e) { + throw new Exception( + "Polling for TnLookup order status failed. \nStatus Code: " + String.valueOf(e.getCode()) + + "\nMessage: " + e.getMessage()); + } + } while (attempt <= 5 && lookupStatus.getStatus() != LookupStatusEnum.COMPLETE); + return lookupStatus; + } + + @Test + public void successfulPhoneNumberLookup() throws Exception, ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + lookupRequest.addTnsItem(BW_NUMBER); + lookupRequest.addTnsItem(VZW_NUMBER); + lookupRequest.addTnsItem(ATT_NUMBER); + lookupRequest.addTnsItem(T_MOBILE_NUMBER); + + // Create the lookup request and validate the response + ApiResponse response = api.createLookupWithHttpInfo(BW_ACCOUNT_ID, lookupRequest); + CreateLookupResponse lookupResponse = response.getData(); + assertThat(response.getStatusCode(), is(202)); + assertThat(response.getData(), instanceOf(CreateLookupResponse.class)); + assertThat(lookupResponse.getStatus(), is(LookupStatusEnum.IN_PROGRESS)); + assertThat(lookupResponse.getRequestId(), instanceOf(String.class)); + assertThat(lookupResponse.getRequestId(), + matchesRegex("^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$")); + + // Test GET LookupStatus Response + ApiResponse lookupStatusResponse = api.getLookupStatusWithHttpInfo(BW_ACCOUNT_ID, + lookupResponse.getRequestId()); + assertThat(lookupStatusResponse.getStatusCode(), is(200)); + + LookupStatus completedLookup = null; + try { + completedLookup = pollLookupStatus(lookupStatusResponse.getData().getRequestId()); + } catch (Exception e) { + throw e; + } + assertThat(lookupStatusResponse.getData().getRequestId(), is(completedLookup.getRequestId())); + + for (LookupResult result : completedLookup.getResult()) { + assertThat(result, instanceOf(LookupResult.class)); + } + + LookupResult bwLookupResult = completedLookup.getResult().get(0); + validateResult(bwLookupResult, BW_NUMBER); + + LookupResult vzwLookupResult = completedLookup.getResult().get(1); + validateResult(vzwLookupResult, VZW_NUMBER); + + LookupResult attLookupResult = completedLookup.getResult().get(2); + validateResult(attLookupResult, ATT_NUMBER); + + LookupResult tMobileLookupResult = completedLookup.getResult().get(3); + validateResult(tMobileLookupResult, T_MOBILE_NUMBER); + + } + + @Test + public void failedPhoneNumberLookup() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + lookupRequest.addTnsItem("not a number"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createLookup(BW_ACCOUNT_ID, lookupRequest)); + assertThat(exception.getCode(), is(400)); + } + + @Test + public void duplicatePhoneNumberLookup() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + lookupRequest.addTnsItem(BW_NUMBER); + lookupRequest.addTnsItem(BW_NUMBER); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createLookup(BW_ACCOUNT_ID, lookupRequest)); + assertThat(exception.getCode(), is(400)); + } + + @Test + public void unauthorizedRequest() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + lookupRequest.addTnsItem(BW_NUMBER); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createLookup(BW_ACCOUNT_ID, lookupRequest)); + assertThat(exception.getCode(), is(401)); + } + + @Disabled(("403 Response is not implemented in the API")) + @Test + public void forbiddenRequest() throws ApiException { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + lookupRequest.addTnsItem(BW_NUMBER); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> api.createLookup(BW_ACCOUNT_ID, lookupRequest)); + assertThat(exception.getCode(), is(403)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/RecordingsApiTest.java b/src/test/java/com/bandwidth/sdk/api/RecordingsApiTest.java new file mode 100644 index 00000000..6eb6faaf --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/RecordingsApiTest.java @@ -0,0 +1,436 @@ +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiResponse; +import com.bandwidth.sdk.ApiClient; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.auth.HttpBasicAuth; +import com.bandwidth.sdk.Configuration; +import com.bandwidth.sdk.model.CallRecordingMetadata; +import com.bandwidth.sdk.model.CallStateEnum; +import com.bandwidth.sdk.model.CreateCall; +import com.bandwidth.sdk.model.CreateCallResponse; +import com.bandwidth.sdk.model.RecordingStateEnum; +import com.bandwidth.sdk.model.TranscribeRecording; +import com.bandwidth.sdk.model.TranscriptionList; +import com.bandwidth.sdk.model.UpdateCall; +import com.bandwidth.sdk.model.UpdateCallRecording; +import com.bandwidth.sdk.utils.MantecaStatusResponse; + +import com.google.gson.Gson; + +import okhttp3.Call; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; +import static com.bandwidth.sdk.utils.CallCleanup.Cleanup; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class RecordingsApiTest { + public ApiClient defaultClient = Configuration.getDefaultApiClient(); + public HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic"); + public final CallsApi callsApi = new CallsApi(defaultClient); + public final RecordingsApi recordingsApi = new RecordingsApi(defaultClient); + + private static final OkHttpClient mantecaClient = new OkHttpClient(); + public static final MediaType jsonMediaType = MediaType.get("application/json; charset=utf-8"); + + public static TranscribeRecording transcribeRecording = new TranscribeRecording(); + + private static String testId; + private static URI answerUrl; + private static String callId; + private static String recordingId; + private static int TEST_SLEEP = 3; + private static int MAX_RETRIES = 40; + + private static CreateCall createCallBody = new CreateCall(); + + @BeforeAll + public static void setUpBeforeClass() throws URISyntaxException { + // answerUrl = new URI(MANTECA_BASE_URL + "/bxml/startRecording"); + answerUrl = new URI(MANTECA_BASE_URL + "/bxml/startLongRecording"); + } + + @AfterAll + public void tearDownAfterClass() throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + Cleanup(this, callId); + } + + static final String constructMantecaJsonBody() { + return "{\"os\": \"" + OPERATING_SYSTEM + "\", \"language\":\"JAVA" + JAVA_VERSION + "_" + DISTRIBUTION + + "\", \"type\":\"CALL\"}"; + } + + public MantecaStatusResponse getTestStatus(String mantecaTestId) throws Exception { + try { + // Setup the test with Manteca + Request mantecaStatusRequest = new Request.Builder() + .url(MANTECA_STATUS_URL + mantecaTestId) + .build(); + Call mantecaStatusApiCall = mantecaClient.newCall(mantecaStatusRequest); + Response mantecaStatusResponse = mantecaStatusApiCall.execute(); + + Gson gson = new Gson(); + MantecaStatusResponse mantecaStatus = gson.fromJson( + mantecaStatusResponse.peekBody(2048).string(), + MantecaStatusResponse.class); + if (mantecaStatusResponse.isSuccessful()) { + return mantecaStatus; + } else { + System.out.println(mantecaStatusResponse.body().string()); + throw new Exception( + "Received HTTP " + String.valueOf(mantecaStatusResponse.code()) + " status code from Manteca"); + } + } catch (IOException e) { + System.out.println(e.toString()); + throw new Exception("Failed to get test status from Manteca, aborting test run :("); + } + } + + @Test + @Order(1) + public void testCallRecordingAndTranscription() throws Exception { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + String mantecaJsonBody = constructMantecaJsonBody(); + RequestBody mantecaRequestBody = RequestBody.create(mantecaJsonBody, jsonMediaType); + + try { + // Setup the test with Manteca + Request mantecaRequest = new Request.Builder() + .url(MANTECA_BASE_URL + "/tests") + .post(mantecaRequestBody) + .build(); + Call mantecaApiCall = mantecaClient.newCall(mantecaRequest); + testId = mantecaApiCall.execute().body().string(); + } catch (IOException e) { + System.out.println(e.toString()); + throw new Exception("Failed to initialize conference tests with Manteca, aborting test run :("); + } + + createCallBody.setTo(MANTECA_IDLE_NUMBER); + createCallBody.setFrom(MANTECA_ACTIVE_NUMBER); + createCallBody.setApplicationId(MANTECA_APPLICATION_ID); + createCallBody.setAnswerUrl(answerUrl); + createCallBody.setTag(testId); + + // Create Call + CreateCallResponse callResponse = callsApi.createCall(BW_ACCOUNT_ID, createCallBody); + callId = callResponse.getCallId(); + + // Update Recording + TimeUnit.SECONDS.sleep(TEST_SLEEP * 2); + UpdateCallRecording updateRecording = new UpdateCallRecording(); + updateRecording.setState(RecordingStateEnum.PAUSED); + + ApiResponse pauseRecordingResponse = recordingsApi.updateCallRecordingStateWithHttpInfo(BW_ACCOUNT_ID, + callId, updateRecording); + assertThat(pauseRecordingResponse.getStatusCode(), is(200)); + + // Update Recording + TimeUnit.SECONDS.sleep(TEST_SLEEP); + updateRecording.setState(RecordingStateEnum.RECORDING); + + ApiResponse resumeRecordingResponse = recordingsApi.updateCallRecordingStateWithHttpInfo(BW_ACCOUNT_ID, + callId, updateRecording); + assertThat(resumeRecordingResponse.getStatusCode(), is(200)); + + // Terminate the call + UpdateCall updateCall = new UpdateCall(); + updateCall.setState(CallStateEnum.COMPLETED); + ApiResponse updateCallResponse = callsApi.updateCallWithHttpInfo(BW_ACCOUNT_ID, callId, + updateCall); + assertThat(updateCallResponse.getStatusCode(), is(200)); + + // Make sure its been recorded by fetching the status from Manteca + int x = 0; + Boolean recordingStatus = false; + while (recordingStatus != true && x < MAX_RETRIES) { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + recordingStatus = getTestStatus(testId).callRecorded; + x++; + } + assertThat(recordingStatus, is(true)); + + // Validate the recording metadata endpoint + ApiResponse> listRecordingMetadataResponse = recordingsApi + .listCallRecordingsWithHttpInfo(BW_ACCOUNT_ID, callId); + assertThat(listRecordingMetadataResponse.getStatusCode(), is(200)); + recordingId = listRecordingMetadataResponse.getData().get(0).getRecordingId(); + + ApiResponse recordingMetadataResponse = recordingsApi.getCallRecordingWithHttpInfo( + BW_ACCOUNT_ID, callId, recordingId); + assertThat(recordingMetadataResponse.getStatusCode(), is(200)); + + // Pass the tag to transcribeRecording to receive the callback + transcribeRecording.callbackUrl(new URI(MANTECA_BASE_URL + "/transcriptions")); + transcribeRecording.setTag(testId); + + ApiResponse requestTranscriptionResponse = recordingsApi.transcribeCallRecordingWithHttpInfo( + BW_ACCOUNT_ID, callId, recordingId, transcribeRecording); + assertThat(requestTranscriptionResponse.getStatusCode(), is(204)); + + // Make sure its been transcribed by fetching status from manteca + int i = 0; + Boolean transcriptionStatus = false; + while (transcriptionStatus != true && i < MAX_RETRIES) { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + transcriptionStatus = getTestStatus(testId).callTranscribed; + i++; + } + assertThat(transcriptionStatus, is(true)); + + // Validate the transcription metadata endpoint + ApiResponse listTranscriptionsResponse = recordingsApi + .getCallTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId); + assertThat(listTranscriptionsResponse.getStatusCode(), is(200)); + + // Delete transcription + ApiResponse deleteTranscriptionResponse = recordingsApi.deleteCallTranscriptionWithHttpInfo(BW_ACCOUNT_ID, + callId, recordingId); + assertThat(deleteTranscriptionResponse.getStatusCode(), is(204)); + + // Delete recording media + ApiResponse deleteRecordingMediaResponse = recordingsApi.deleteRecordingMediaWithHttpInfo(BW_ACCOUNT_ID, + callId, recordingId); + assertThat(deleteRecordingMediaResponse.getStatusCode(), is(204)); + + // Delete recording metadata + ApiResponse deleteRecordingMetadataResponse = recordingsApi.deleteRecordingWithHttpInfo(BW_ACCOUNT_ID, + callId, recordingId); + assertThat(deleteRecordingMetadataResponse.getStatusCode(), is(204)); + } + + @Test + public void testGetAccountRecordings() throws ApiException { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiResponse> response = recordingsApi + .listAccountCallRecordingsWithHttpInfo(BW_ACCOUNT_ID, null, null, null, + null); + + assertThat(response.getStatusCode(), is(200)); + } + + @Test + public void testGetAccountRecordingsUnauthorized() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.listAccountCallRecordingsWithHttpInfo(BW_ACCOUNT_ID, + null, null, null, null)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testGetAccountRecordingsForbidden() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.listAccountCallRecordingsWithHttpInfo(BW_ACCOUNT_ID, + null, null, null, null)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testRecordingNotFound() { + Basic.setUsername(BW_USERNAME); + Basic.setPassword(BW_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.getCallRecording(BW_ACCOUNT_ID, "not a call", "not a recording")); + + assertThat(exception.getCode(), is(404)); + } + + @Test + public void testUnauthorizedGetRecording() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.getCallRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenGetRecording() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.getCallRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedDeleteRecording() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenDeleteRecording() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedDownloadRecording() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.downloadCallRecording(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenDownloadRecording() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.downloadCallRecording(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedDeleteRecordingMedia() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenDeleteRecordingMedia() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteRecording(BW_ACCOUNT_ID, callId, recordingId)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedGetTranscription() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenGetTranscription() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedCreateTranscriptionRequest() { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.transcribeCallRecording(BW_ACCOUNT_ID, callId, + recordingId, transcribeRecording)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenCreateTranscriptionRequest() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.transcribeCallRecording(BW_ACCOUNT_ID, callId, + recordingId, transcribeRecording)); + + assertThat(exception.getCode(), is(403)); + } + + @Test + public void testUnauthorizedDeleteTranscription() throws ApiException { + Basic.setUsername("bad_username"); + Basic.setPassword("bad_password"); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(401)); + } + + @Test + public void testForbiddenDeleteTranscription() { + Basic.setUsername(FORBIDDEN_USERNAME); + Basic.setPassword(FORBIDDEN_PASSWORD); + + ApiException exception = Assertions.assertThrows(ApiException.class, + () -> recordingsApi.deleteCallTranscription(BW_ACCOUNT_ID, callId, + recordingId)); + + assertThat(exception.getCode(), is(403)); + } +} diff --git a/src/test/java/com/bandwidth/sdk/api/StatisticsApiTest.java b/src/test/java/com/bandwidth/sdk/api/StatisticsApiTest.java new file mode 100644 index 00000000..5f5d855b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/api/StatisticsApiTest.java @@ -0,0 +1,49 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.api; + +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.model.AccountStatistics; +import com.bandwidth.sdk.model.VoiceApiError; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StatisticsApi + */ +@Disabled +public class StatisticsApiTest { + + private final StatisticsApi api = new StatisticsApi(); + + /** + * Get Account Statistics + * + * Returns details about the current state of the account. + * + * @throws ApiException if the Api call fails + */ + @Test + public void getStatisticsTest() throws ApiException { + String accountId = null; + AccountStatistics response = api.getStatistics(accountId); + // TODO: test validations + } + +} diff --git a/src/test/java/com/bandwidth/sdk/fixtures/cat_download.jpeg b/src/test/java/com/bandwidth/sdk/fixtures/cat_download.jpeg new file mode 100644 index 00000000..d08a926e Binary files /dev/null and b/src/test/java/com/bandwidth/sdk/fixtures/cat_download.jpeg differ diff --git a/src/test/java/com/bandwidth/sdk/fixtures/java_cat.jpeg b/src/test/java/com/bandwidth/sdk/fixtures/java_cat.jpeg new file mode 100644 index 00000000..d08a926e Binary files /dev/null and b/src/test/java/com/bandwidth/sdk/fixtures/java_cat.jpeg differ diff --git a/src/test/java/com/bandwidth/sdk/model/AccountStatisticsTest.java b/src/test/java/com/bandwidth/sdk/model/AccountStatisticsTest.java new file mode 100644 index 00000000..bdb327e6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/AccountStatisticsTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AccountStatistics + */ +public class AccountStatisticsTest { + private final AccountStatistics model = new AccountStatistics(); + + /** + * Model tests for AccountStatistics + */ + @Test + public void testAccountStatistics() { + // TODO: test AccountStatistics + } + + /** + * Test the property 'currentCallQueueSize' + */ + @Test + public void currentCallQueueSizeTest() { + // TODO: test currentCallQueueSize + } + + /** + * Test the property 'maxCallQueueSize' + */ + @Test + public void maxCallQueueSizeTest() { + // TODO: test maxCallQueueSize + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/AnswerCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/AnswerCallbackTest.java new file mode 100644 index 00000000..d1235bfa --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/AnswerCallbackTest.java @@ -0,0 +1,157 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for AnswerCallback + */ +public class AnswerCallbackTest { + private final AnswerCallback model = new AnswerCallback(); + + /** + * Model tests for AnswerCallback + */ + @Test + public void testAnswerCallback() { + // TODO: test AnswerCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'machineDetectionResult' + */ + @Test + public void machineDetectionResultTest() { + // TODO: test machineDetectionResult + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/BridgeCompleteCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/BridgeCompleteCallbackTest.java new file mode 100644 index 00000000..c4265322 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/BridgeCompleteCallbackTest.java @@ -0,0 +1,173 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BridgeCompleteCallback + */ +public class BridgeCompleteCallbackTest { + private final BridgeCompleteCallback model = new BridgeCompleteCallback(); + + /** + * Model tests for BridgeCompleteCallback + */ + @Test + public void testBridgeCompleteCallback() { + // TODO: test BridgeCompleteCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'cause' + */ + @Test + public void causeTest() { + // TODO: test cause + } + + /** + * Test the property 'errorMessage' + */ + @Test + public void errorMessageTest() { + // TODO: test errorMessage + } + + /** + * Test the property 'errorId' + */ + @Test + public void errorIdTest() { + // TODO: test errorId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallbackTest.java new file mode 100644 index 00000000..54470f93 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/BridgeTargetCompleteCallbackTest.java @@ -0,0 +1,149 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for BridgeTargetCompleteCallback + */ +public class BridgeTargetCompleteCallbackTest { + private final BridgeTargetCompleteCallback model = new BridgeTargetCompleteCallback(); + + /** + * Model tests for BridgeTargetCompleteCallback + */ + @Test + public void testBridgeTargetCompleteCallback() { + // TODO: test BridgeTargetCompleteCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CallDirectionEnumTest.java b/src/test/java/com/bandwidth/sdk/model/CallDirectionEnumTest.java new file mode 100644 index 00000000..f61d6e0c --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CallDirectionEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CallDirectionEnum + */ +public class CallDirectionEnumTest { + /** + * Model tests for CallDirectionEnum + */ + @Test + public void testCallDirectionEnum() { + // TODO: test CallDirectionEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CallRecordingMetadataTest.java b/src/test/java/com/bandwidth/sdk/model/CallRecordingMetadataTest.java new file mode 100644 index 00000000..c73ee601 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CallRecordingMetadataTest.java @@ -0,0 +1,192 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.bandwidth.sdk.model.TranscriptionMetadata; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CallRecordingMetadata + */ +public class CallRecordingMetadataTest { + private final CallRecordingMetadata model = new CallRecordingMetadata(); + + /** + * Model tests for CallRecordingMetadata + */ + @Test + public void testCallRecordingMetadata() { + // TODO: test CallRecordingMetadata + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'channels' + */ + @Test + public void channelsTest() { + // TODO: test channels + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + + /** + * Test the property 'transcription' + */ + @Test + public void transcriptionTest() { + // TODO: test transcription + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CallStateEnumTest.java b/src/test/java/com/bandwidth/sdk/model/CallStateEnumTest.java new file mode 100644 index 00000000..4e869b08 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CallStateEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CallStateEnum + */ +public class CallStateEnumTest { + /** + * Model tests for CallStateEnum + */ + @Test + public void testCallStateEnum() { + // TODO: test CallStateEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CallStateTest.java b/src/test/java/com/bandwidth/sdk/model/CallStateTest.java new file mode 100644 index 00000000..db4f54d9 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CallStateTest.java @@ -0,0 +1,191 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CallState + */ +public class CallStateTest { + private final CallState model = new CallState(); + + /** + * Model tests for CallState + */ + @Test + public void testCallState() { + // TODO: test CallState + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + // TODO: test state + } + + /** + * Test the property 'stirShaken' + */ + @Test + public void stirShakenTest() { + // TODO: test stirShaken + } + + /** + * Test the property 'identity' + */ + @Test + public void identityTest() { + // TODO: test identity + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'disconnectCause' + */ + @Test + public void disconnectCauseTest() { + // TODO: test disconnectCause + } + + /** + * Test the property 'errorMessage' + */ + @Test + public void errorMessageTest() { + // TODO: test errorMessage + } + + /** + * Test the property 'errorId' + */ + @Test + public void errorIdTest() { + // TODO: test errorId + } + + /** + * Test the property 'lastUpdate' + */ + @Test + public void lastUpdateTest() { + // TODO: test lastUpdate + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CallbackMethodEnumTest.java b/src/test/java/com/bandwidth/sdk/model/CallbackMethodEnumTest.java new file mode 100644 index 00000000..75858623 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CallbackMethodEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CallbackMethodEnum + */ +public class CallbackMethodEnumTest { + /** + * Model tests for CallbackMethodEnum + */ + @Test + public void testCallbackMethodEnum() { + // TODO: test CallbackMethodEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CodeRequestTest.java b/src/test/java/com/bandwidth/sdk/model/CodeRequestTest.java new file mode 100644 index 00000000..e088e0ed --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CodeRequestTest.java @@ -0,0 +1,90 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CodeRequest + */ +public class CodeRequestTest { + private final CodeRequest model = new CodeRequest(); + + /** + * Model tests for CodeRequest + */ + @Test + public void testCodeRequest() { + // TODO: test CodeRequest + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'scope' + */ + @Test + public void scopeTest() { + // TODO: test scope + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + + /** + * Test the property 'digits' + */ + @Test + public void digitsTest() { + // TODO: test digits + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceCompletedCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceCompletedCallbackTest.java new file mode 100644 index 00000000..9881efa7 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceCompletedCallbackTest.java @@ -0,0 +1,83 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceCompletedCallback + */ +public class ConferenceCompletedCallbackTest { + private final ConferenceCompletedCallback model = new ConferenceCompletedCallback(); + + /** + * Model tests for ConferenceCompletedCallback + */ + @Test + public void testConferenceCompletedCallback() { + // TODO: test ConferenceCompletedCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceCreatedCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceCreatedCallbackTest.java new file mode 100644 index 00000000..62f2a0db --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceCreatedCallbackTest.java @@ -0,0 +1,83 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceCreatedCallback + */ +public class ConferenceCreatedCallbackTest { + private final ConferenceCreatedCallback model = new ConferenceCreatedCallback(); + + /** + * Model tests for ConferenceCreatedCallback + */ + @Test + public void testConferenceCreatedCallback() { + // TODO: test ConferenceCreatedCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceMemberExitCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberExitCallbackTest.java new file mode 100644 index 00000000..bb4c9956 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberExitCallbackTest.java @@ -0,0 +1,107 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceMemberExitCallback + */ +public class ConferenceMemberExitCallbackTest { + private final ConferenceMemberExitCallback model = new ConferenceMemberExitCallback(); + + /** + * Model tests for ConferenceMemberExitCallback + */ + @Test + public void testConferenceMemberExitCallback() { + // TODO: test ConferenceMemberExitCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallbackTest.java new file mode 100644 index 00000000..ffcadd6f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberJoinCallbackTest.java @@ -0,0 +1,107 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceMemberJoinCallback + */ +public class ConferenceMemberJoinCallbackTest { + private final ConferenceMemberJoinCallback model = new ConferenceMemberJoinCallback(); + + /** + * Model tests for ConferenceMemberJoinCallback + */ + @Test + public void testConferenceMemberJoinCallback() { + // TODO: test ConferenceMemberJoinCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceMemberTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberTest.java new file mode 100644 index 00000000..d651c1ff --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceMemberTest.java @@ -0,0 +1,93 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceMember + */ +public class ConferenceMemberTest { + private final ConferenceMember model = new ConferenceMember(); + + /** + * Model tests for ConferenceMember + */ + @Test + public void testConferenceMember() { + // TODO: test ConferenceMember + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'memberUrl' + */ + @Test + public void memberUrlTest() { + // TODO: test memberUrl + } + + /** + * Test the property 'mute' + */ + @Test + public void muteTest() { + // TODO: test mute + } + + /** + * Test the property 'hold' + */ + @Test + public void holdTest() { + // TODO: test hold + } + + /** + * Test the property 'callIdsToCoach' + */ + @Test + public void callIdsToCoachTest() { + // TODO: test callIdsToCoach + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallbackTest.java new file mode 100644 index 00000000..abf499cc --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingAvailableCallbackTest.java @@ -0,0 +1,158 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.FileFormatEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceRecordingAvailableCallback + */ +public class ConferenceRecordingAvailableCallbackTest { + private final ConferenceRecordingAvailableCallback model = new ConferenceRecordingAvailableCallback(); + + /** + * Model tests for ConferenceRecordingAvailableCallback + */ + @Test + public void testConferenceRecordingAvailableCallback() { + // TODO: test ConferenceRecordingAvailableCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'channels' + */ + @Test + public void channelsTest() { + // TODO: test channels + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingMetadataTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingMetadataTest.java new file mode 100644 index 00000000..acff8fe2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceRecordingMetadataTest.java @@ -0,0 +1,134 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.FileFormatEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceRecordingMetadata + */ +public class ConferenceRecordingMetadataTest { + private final ConferenceRecordingMetadata model = new ConferenceRecordingMetadata(); + + /** + * Model tests for ConferenceRecordingMetadata + */ + @Test + public void testConferenceRecordingMetadata() { + // TODO: test ConferenceRecordingMetadata + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'channels' + */ + @Test + public void channelsTest() { + // TODO: test channels + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceRedirectCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceRedirectCallbackTest.java new file mode 100644 index 00000000..e893500f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceRedirectCallbackTest.java @@ -0,0 +1,83 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceRedirectCallback + */ +public class ConferenceRedirectCallbackTest { + private final ConferenceRedirectCallback model = new ConferenceRedirectCallback(); + + /** + * Model tests for ConferenceRedirectCallback + */ + @Test + public void testConferenceRedirectCallback() { + // TODO: test ConferenceRedirectCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'conferenceId' + */ + @Test + public void conferenceIdTest() { + // TODO: test conferenceId + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceStateEnumTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceStateEnumTest.java new file mode 100644 index 00000000..f95a6a27 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceStateEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ConferenceStateEnum + */ +public class ConferenceStateEnumTest { + /** + * Model tests for ConferenceStateEnum + */ + @Test + public void testConferenceStateEnum() { + // TODO: test ConferenceStateEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ConferenceTest.java b/src/test/java/com/bandwidth/sdk/model/ConferenceTest.java new file mode 100644 index 00000000..bb40af6d --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ConferenceTest.java @@ -0,0 +1,113 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.ConferenceMember; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Conference + */ +public class ConferenceTest { + private final Conference model = new Conference(); + + /** + * Model tests for Conference + */ + @Test + public void testConference() { + // TODO: test Conference + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'name' + */ + @Test + public void nameTest() { + // TODO: test name + } + + /** + * Test the property 'createdTime' + */ + @Test + public void createdTimeTest() { + // TODO: test createdTime + } + + /** + * Test the property 'completedTime' + */ + @Test + public void completedTimeTest() { + // TODO: test completedTime + } + + /** + * Test the property 'conferenceEventUrl' + */ + @Test + public void conferenceEventUrlTest() { + // TODO: test conferenceEventUrl + } + + /** + * Test the property 'conferenceEventMethod' + */ + @Test + public void conferenceEventMethodTest() { + // TODO: test conferenceEventMethod + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'activeMembers' + */ + @Test + public void activeMembersTest() { + // TODO: test activeMembers + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CreateCallResponseTest.java b/src/test/java/com/bandwidth/sdk/model/CreateCallResponseTest.java new file mode 100644 index 00000000..4769d020 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CreateCallResponseTest.java @@ -0,0 +1,215 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.math.BigDecimal; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CreateCallResponse + */ +public class CreateCallResponseTest { + private final CreateCallResponse model = new CreateCallResponse(); + + /** + * Model tests for CreateCallResponse + */ + @Test + public void testCreateCallResponse() { + // TODO: test CreateCallResponse + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'callTimeout' + */ + @Test + public void callTimeoutTest() { + // TODO: test callTimeout + } + + /** + * Test the property 'callbackTimeout' + */ + @Test + public void callbackTimeoutTest() { + // TODO: test callbackTimeout + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'answerMethod' + */ + @Test + public void answerMethodTest() { + // TODO: test answerMethod + } + + /** + * Test the property 'answerUrl' + */ + @Test + public void answerUrlTest() { + // TODO: test answerUrl + } + + /** + * Test the property 'answerFallbackMethod' + */ + @Test + public void answerFallbackMethodTest() { + // TODO: test answerFallbackMethod + } + + /** + * Test the property 'answerFallbackUrl' + */ + @Test + public void answerFallbackUrlTest() { + // TODO: test answerFallbackUrl + } + + /** + * Test the property 'disconnectMethod' + */ + @Test + public void disconnectMethodTest() { + // TODO: test disconnectMethod + } + + /** + * Test the property 'disconnectUrl' + */ + @Test + public void disconnectUrlTest() { + // TODO: test disconnectUrl + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'fallbackUsername' + */ + @Test + public void fallbackUsernameTest() { + // TODO: test fallbackUsername + } + + /** + * Test the property 'fallbackPassword' + */ + @Test + public void fallbackPasswordTest() { + // TODO: test fallbackPassword + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CreateCallTest.java b/src/test/java/com/bandwidth/sdk/model/CreateCallTest.java new file mode 100644 index 00000000..c7b39f95 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CreateCallTest.java @@ -0,0 +1,198 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.MachineDetectionConfiguration; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CreateCall + */ +public class CreateCallTest { + private final CreateCall model = new CreateCall(); + + /** + * Model tests for CreateCall + */ + @Test + public void testCreateCall() { + // TODO: test CreateCall + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'uui' + */ + @Test + public void uuiTest() { + // TODO: test uui + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'answerUrl' + */ + @Test + public void answerUrlTest() { + // TODO: test answerUrl + } + + /** + * Test the property 'answerMethod' + */ + @Test + public void answerMethodTest() { + // TODO: test answerMethod + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'answerFallbackUrl' + */ + @Test + public void answerFallbackUrlTest() { + // TODO: test answerFallbackUrl + } + + /** + * Test the property 'answerFallbackMethod' + */ + @Test + public void answerFallbackMethodTest() { + // TODO: test answerFallbackMethod + } + + /** + * Test the property 'fallbackUsername' + */ + @Test + public void fallbackUsernameTest() { + // TODO: test fallbackUsername + } + + /** + * Test the property 'fallbackPassword' + */ + @Test + public void fallbackPasswordTest() { + // TODO: test fallbackPassword + } + + /** + * Test the property 'disconnectUrl' + */ + @Test + public void disconnectUrlTest() { + // TODO: test disconnectUrl + } + + /** + * Test the property 'disconnectMethod' + */ + @Test + public void disconnectMethodTest() { + // TODO: test disconnectMethod + } + + /** + * Test the property 'callTimeout' + */ + @Test + public void callTimeoutTest() { + // TODO: test callTimeout + } + + /** + * Test the property 'callbackTimeout' + */ + @Test + public void callbackTimeoutTest() { + // TODO: test callbackTimeout + } + + /** + * Test the property 'machineDetection' + */ + @Test + public void machineDetectionTest() { + // TODO: test machineDetection + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CreateLookupResponseTest.java b/src/test/java/com/bandwidth/sdk/model/CreateLookupResponseTest.java new file mode 100644 index 00000000..03fe60a2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CreateLookupResponseTest.java @@ -0,0 +1,59 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import com.bandwidth.sdk.model.LookupStatusEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CreateLookupResponse + */ +public class CreateLookupResponseTest { + private final CreateLookupResponse model = new CreateLookupResponse(); + + /** + * Model tests for CreateLookupResponse + */ + @Test + public void testCreateLookupResponse() { + // TODO: test CreateLookupResponse + } + + /** + * Test the property 'requestId' + */ + @Test + public void requestIdTest() { + // TODO: test requestId + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/CreateMessageRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/CreateMessageRequestErrorTest.java new file mode 100644 index 00000000..f9ca9bc6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/CreateMessageRequestErrorTest.java @@ -0,0 +1,69 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.bandwidth.sdk.model.FieldError; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for CreateMessageRequestError + */ +public class CreateMessageRequestErrorTest { + private final CreateMessageRequestError model = new CreateMessageRequestError(); + + /** + * Model tests for CreateMessageRequestError + */ + @Test + public void testCreateMessageRequestError() { + // TODO: test CreateMessageRequestError + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'fieldErrors' + */ + @Test + public void fieldErrorsTest() { + // TODO: test fieldErrors + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/DeferredResultTest.java b/src/test/java/com/bandwidth/sdk/model/DeferredResultTest.java new file mode 100644 index 00000000..a583c7d7 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/DeferredResultTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for DeferredResult + */ +public class DeferredResultTest { + private final DeferredResult model = new DeferredResult(); + + /** + * Model tests for DeferredResult + */ + @Test + public void testDeferredResult() { + // TODO: test DeferredResult + } + + /** + * Test the property 'result' + */ + @Test + public void resultTest() { + // TODO: test result + } + + /** + * Test the property 'setOrExpired' + */ + @Test + public void setOrExpiredTest() { + // TODO: test setOrExpired + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/DisconnectCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/DisconnectCallbackTest.java new file mode 100644 index 00000000..97de1e3b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/DisconnectCallbackTest.java @@ -0,0 +1,179 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for DisconnectCallback + */ +public class DisconnectCallbackTest { + private final DisconnectCallback model = new DisconnectCallback(); + + /** + * Model tests for DisconnectCallback + */ + @Test + public void testDisconnectCallback() { + // TODO: test DisconnectCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'cause' + */ + @Test + public void causeTest() { + // TODO: test cause + } + + /** + * Test the property 'errorMessage' + */ + @Test + public void errorMessageTest() { + // TODO: test errorMessage + } + + /** + * Test the property 'errorId' + */ + @Test + public void errorIdTest() { + // TODO: test errorId + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/DiversionTest.java b/src/test/java/com/bandwidth/sdk/model/DiversionTest.java new file mode 100644 index 00000000..60c5dbad --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/DiversionTest.java @@ -0,0 +1,98 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Diversion + */ +public class DiversionTest { + private final Diversion model = new Diversion(); + + /** + * Model tests for Diversion + */ + @Test + public void testDiversion() { + // TODO: test Diversion + } + + /** + * Test the property 'reason' + */ + @Test + public void reasonTest() { + // TODO: test reason + } + + /** + * Test the property 'privacy' + */ + @Test + public void privacyTest() { + // TODO: test privacy + } + + /** + * Test the property 'screen' + */ + @Test + public void screenTest() { + // TODO: test screen + } + + /** + * Test the property 'counter' + */ + @Test + public void counterTest() { + // TODO: test counter + } + + /** + * Test the property 'limit' + */ + @Test + public void limitTest() { + // TODO: test limit + } + + /** + * Test the property 'unknown' + */ + @Test + public void unknownTest() { + // TODO: test unknown + } + + /** + * Test the property 'origTo' + */ + @Test + public void origToTest() { + // TODO: test origTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/DtmfCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/DtmfCallbackTest.java new file mode 100644 index 00000000..495e3a65 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/DtmfCallbackTest.java @@ -0,0 +1,181 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for DtmfCallback + */ +public class DtmfCallbackTest { + private final DtmfCallback model = new DtmfCallback(); + + /** + * Model tests for DtmfCallback + */ + @Test + public void testDtmfCallback() { + // TODO: test DtmfCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'digit' + */ + @Test + public void digitTest() { + // TODO: test digit + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/FieldErrorTest.java b/src/test/java/com/bandwidth/sdk/model/FieldErrorTest.java new file mode 100644 index 00000000..5f0aea81 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/FieldErrorTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FieldError + */ +public class FieldErrorTest { + private final FieldError model = new FieldError(); + + /** + * Model tests for FieldError + */ + @Test + public void testFieldError() { + // TODO: test FieldError + } + + /** + * Test the property 'fieldName' + */ + @Test + public void fieldNameTest() { + // TODO: test fieldName + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/FileFormatEnumTest.java b/src/test/java/com/bandwidth/sdk/model/FileFormatEnumTest.java new file mode 100644 index 00000000..eaa520db --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/FileFormatEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for FileFormatEnum + */ +public class FileFormatEnumTest { + /** + * Model tests for FileFormatEnum + */ + @Test + public void testFileFormatEnum() { + // TODO: test FileFormatEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/GatherCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/GatherCallbackTest.java new file mode 100644 index 00000000..f3810647 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/GatherCallbackTest.java @@ -0,0 +1,189 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for GatherCallback + */ +public class GatherCallbackTest { + private final GatherCallback model = new GatherCallback(); + + /** + * Model tests for GatherCallback + */ + @Test + public void testGatherCallback() { + // TODO: test GatherCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'digits' + */ + @Test + public void digitsTest() { + // TODO: test digits + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'terminatingDigit' + */ + @Test + public void terminatingDigitTest() { + // TODO: test terminatingDigit + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackMessageTest.java new file mode 100644 index 00000000..bed2bfa0 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackMessageTest.java @@ -0,0 +1,144 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for InboundMessageCallbackMessage + */ +public class InboundMessageCallbackMessageTest { + private final InboundMessageCallbackMessage model = new InboundMessageCallbackMessage(); + + /** + * Model tests for InboundMessageCallbackMessage + */ + @Test + public void testInboundMessageCallbackMessage() { + // TODO: test InboundMessageCallbackMessage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + // TODO: test owner + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackTest.java new file mode 100644 index 00000000..861f1942 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/InboundMessageCallbackTest.java @@ -0,0 +1,82 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.InboundMessageCallbackMessage; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for InboundMessageCallback + */ +public class InboundMessageCallbackTest { + private final InboundMessageCallback model = new InboundMessageCallback(); + + /** + * Model tests for InboundMessageCallback + */ + @Test + public void testInboundMessageCallback() { + // TODO: test InboundMessageCallback + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/InitiateCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/InitiateCallbackTest.java new file mode 100644 index 00000000..3fd77cfb --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/InitiateCallbackTest.java @@ -0,0 +1,142 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.Diversion; +import com.bandwidth.sdk.model.StirShaken; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for InitiateCallback + */ +public class InitiateCallbackTest { + private final InitiateCallback model = new InitiateCallback(); + + /** + * Model tests for InitiateCallback + */ + @Test + public void testInitiateCallback() { + // TODO: test InitiateCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'diversion' + */ + @Test + public void diversionTest() { + // TODO: test diversion + } + + /** + * Test the property 'stirShaken' + */ + @Test + public void stirShakenTest() { + // TODO: test stirShaken + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ListMessageDirectionEnumTest.java b/src/test/java/com/bandwidth/sdk/model/ListMessageDirectionEnumTest.java new file mode 100644 index 00000000..5973a778 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ListMessageDirectionEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ListMessageDirectionEnum + */ +public class ListMessageDirectionEnumTest { + /** + * Model tests for ListMessageDirectionEnum + */ + @Test + public void testListMessageDirectionEnum() { + // TODO: test ListMessageDirectionEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/ListMessageItemTest.java b/src/test/java/com/bandwidth/sdk/model/ListMessageItemTest.java new file mode 100644 index 00000000..1cd6767b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/ListMessageItemTest.java @@ -0,0 +1,174 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import com.bandwidth.sdk.model.ListMessageDirectionEnum; +import com.bandwidth.sdk.model.MessageStatusEnum; +import com.bandwidth.sdk.model.MessageTypeEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for ListMessageItem + */ +public class ListMessageItemTest { + private final ListMessageItem model = new ListMessageItem(); + + /** + * Model tests for ListMessageItem + */ + @Test + public void testListMessageItem() { + // TODO: test ListMessageItem + } + + /** + * Test the property 'messageId' + */ + @Test + public void messageIdTest() { + // TODO: test messageId + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'sourceTn' + */ + @Test + public void sourceTnTest() { + // TODO: test sourceTn + } + + /** + * Test the property 'destinationTn' + */ + @Test + public void destinationTnTest() { + // TODO: test destinationTn + } + + /** + * Test the property 'messageStatus' + */ + @Test + public void messageStatusTest() { + // TODO: test messageStatus + } + + /** + * Test the property 'messageDirection' + */ + @Test + public void messageDirectionTest() { + // TODO: test messageDirection + } + + /** + * Test the property 'messageType' + */ + @Test + public void messageTypeTest() { + // TODO: test messageType + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'errorCode' + */ + @Test + public void errorCodeTest() { + // TODO: test errorCode + } + + /** + * Test the property 'receiveTime' + */ + @Test + public void receiveTimeTest() { + // TODO: test receiveTime + } + + /** + * Test the property 'carrierName' + */ + @Test + public void carrierNameTest() { + // TODO: test carrierName + } + + /** + * Test the property 'messageSize' + */ + @Test + public void messageSizeTest() { + // TODO: test messageSize + } + + /** + * Test the property 'messageLength' + */ + @Test + public void messageLengthTest() { + // TODO: test messageLength + } + + /** + * Test the property 'attachmentCount' + */ + @Test + public void attachmentCountTest() { + // TODO: test attachmentCount + } + + /** + * Test the property 'recipientCount' + */ + @Test + public void recipientCountTest() { + // TODO: test recipientCount + } + + /** + * Test the property 'campaignClass' + */ + @Test + public void campaignClassTest() { + // TODO: test campaignClass + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/LookupRequestTest.java b/src/test/java/com/bandwidth/sdk/model/LookupRequestTest.java new file mode 100644 index 00000000..1190cf3c --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/LookupRequestTest.java @@ -0,0 +1,52 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for LookupRequest + */ +public class LookupRequestTest { + private final LookupRequest model = new LookupRequest(); + + /** + * Model tests for LookupRequest + */ + @Test + public void testLookupRequest() { + // TODO: test LookupRequest + } + + /** + * Test the property 'tns' + */ + @Test + public void tnsTest() { + // TODO: test tns + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/LookupResultTest.java b/src/test/java/com/bandwidth/sdk/model/LookupResultTest.java new file mode 100644 index 00000000..1e6d0fb0 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/LookupResultTest.java @@ -0,0 +1,114 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for LookupResult + */ +public class LookupResultTest { + private final LookupResult model = new LookupResult(); + + /** + * Model tests for LookupResult + */ + @Test + public void testLookupResult() { + // TODO: test LookupResult + } + + /** + * Test the property 'responseCode' + */ + @Test + public void responseCodeTest() { + // TODO: test responseCode + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + + /** + * Test the property 'e164Format' + */ + @Test + public void e164FormatTest() { + // TODO: test e164Format + } + + /** + * Test the property 'formatted' + */ + @Test + public void formattedTest() { + // TODO: test formatted + } + + /** + * Test the property 'country' + */ + @Test + public void countryTest() { + // TODO: test country + } + + /** + * Test the property 'lineType' + */ + @Test + public void lineTypeTest() { + // TODO: test lineType + } + + /** + * Test the property 'lineProvider' + */ + @Test + public void lineProviderTest() { + // TODO: test lineProvider + } + + /** + * Test the property 'mobileCountryCode' + */ + @Test + public void mobileCountryCodeTest() { + // TODO: test mobileCountryCode + } + + /** + * Test the property 'mobileNetworkCode' + */ + @Test + public void mobileNetworkCodeTest() { + // TODO: test mobileNetworkCode + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/LookupStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/model/LookupStatusEnumTest.java new file mode 100644 index 00000000..c2ef93c1 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/LookupStatusEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for LookupStatusEnum + */ +public class LookupStatusEnumTest { + /** + * Model tests for LookupStatusEnum + */ + @Test + public void testLookupStatusEnum() { + // TODO: test LookupStatusEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/LookupStatusTest.java b/src/test/java/com/bandwidth/sdk/model/LookupStatusTest.java new file mode 100644 index 00000000..a4110aff --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/LookupStatusTest.java @@ -0,0 +1,78 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.bandwidth.sdk.model.LookupResult; +import com.bandwidth.sdk.model.LookupStatusEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for LookupStatus + */ +public class LookupStatusTest { + private final LookupStatus model = new LookupStatus(); + + /** + * Model tests for LookupStatus + */ + @Test + public void testLookupStatus() { + // TODO: test LookupStatus + } + + /** + * Test the property 'requestId' + */ + @Test + public void requestIdTest() { + // TODO: test requestId + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'result' + */ + @Test + public void resultTest() { + // TODO: test result + } + + /** + * Test the property 'failedTelephoneNumbers' + */ + @Test + public void failedTelephoneNumbersTest() { + // TODO: test failedTelephoneNumbers + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallbackTest.java new file mode 100644 index 00000000..5aadebd2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MachineDetectionCompleteCallbackTest.java @@ -0,0 +1,157 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MachineDetectionCompleteCallback + */ +public class MachineDetectionCompleteCallbackTest { + private final MachineDetectionCompleteCallback model = new MachineDetectionCompleteCallback(); + + /** + * Model tests for MachineDetectionCompleteCallback + */ + @Test + public void testMachineDetectionCompleteCallback() { + // TODO: test MachineDetectionCompleteCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'machineDetectionResult' + */ + @Test + public void machineDetectionResultTest() { + // TODO: test machineDetectionResult + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MachineDetectionConfigurationTest.java b/src/test/java/com/bandwidth/sdk/model/MachineDetectionConfigurationTest.java new file mode 100644 index 00000000..cce0b18f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MachineDetectionConfigurationTest.java @@ -0,0 +1,166 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import com.bandwidth.sdk.model.MachineDetectionModeEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MachineDetectionConfiguration + */ +public class MachineDetectionConfigurationTest { + private final MachineDetectionConfiguration model = new MachineDetectionConfiguration(); + + /** + * Model tests for MachineDetectionConfiguration + */ + @Test + public void testMachineDetectionConfiguration() { + // TODO: test MachineDetectionConfiguration + } + + /** + * Test the property 'mode' + */ + @Test + public void modeTest() { + // TODO: test mode + } + + /** + * Test the property 'detectionTimeout' + */ + @Test + public void detectionTimeoutTest() { + // TODO: test detectionTimeout + } + + /** + * Test the property 'silenceTimeout' + */ + @Test + public void silenceTimeoutTest() { + // TODO: test silenceTimeout + } + + /** + * Test the property 'speechThreshold' + */ + @Test + public void speechThresholdTest() { + // TODO: test speechThreshold + } + + /** + * Test the property 'speechEndThreshold' + */ + @Test + public void speechEndThresholdTest() { + // TODO: test speechEndThreshold + } + + /** + * Test the property 'machineSpeechEndThreshold' + */ + @Test + public void machineSpeechEndThresholdTest() { + // TODO: test machineSpeechEndThreshold + } + + /** + * Test the property 'delayResult' + */ + @Test + public void delayResultTest() { + // TODO: test delayResult + } + + /** + * Test the property 'callbackUrl' + */ + @Test + public void callbackUrlTest() { + // TODO: test callbackUrl + } + + /** + * Test the property 'callbackMethod' + */ + @Test + public void callbackMethodTest() { + // TODO: test callbackMethod + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'fallbackUrl' + */ + @Test + public void fallbackUrlTest() { + // TODO: test fallbackUrl + } + + /** + * Test the property 'fallbackMethod' + */ + @Test + public void fallbackMethodTest() { + // TODO: test fallbackMethod + } + + /** + * Test the property 'fallbackUsername' + */ + @Test + public void fallbackUsernameTest() { + // TODO: test fallbackUsername + } + + /** + * Test the property 'fallbackPassword' + */ + @Test + public void fallbackPasswordTest() { + // TODO: test fallbackPassword + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MachineDetectionModeEnumTest.java b/src/test/java/com/bandwidth/sdk/model/MachineDetectionModeEnumTest.java new file mode 100644 index 00000000..308eed02 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MachineDetectionModeEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MachineDetectionModeEnum + */ +public class MachineDetectionModeEnumTest { + /** + * Model tests for MachineDetectionModeEnum + */ + @Test + public void testMachineDetectionModeEnum() { + // TODO: test MachineDetectionModeEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MachineDetectionResultTest.java b/src/test/java/com/bandwidth/sdk/model/MachineDetectionResultTest.java new file mode 100644 index 00000000..dd5f361e --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MachineDetectionResultTest.java @@ -0,0 +1,56 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for MachineDetectionResult + */ +public class MachineDetectionResultTest { + private final MachineDetectionResult model = new MachineDetectionResult(); + + /** + * Model tests for MachineDetectionResult + */ + @Test + public void testMachineDetectionResult() { + // TODO: test MachineDetectionResult + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MediaTest.java b/src/test/java/com/bandwidth/sdk/model/MediaTest.java new file mode 100644 index 00000000..6ab62a52 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MediaTest.java @@ -0,0 +1,66 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Media + */ +public class MediaTest { + private final Media model = new Media(); + + /** + * Model tests for Media + */ + @Test + public void testMedia() { + // TODO: test Media + } + + /** + * Test the property 'content' + */ + @Test + public void contentTest() { + // TODO: test content + } + + /** + * Test the property 'contentLength' + */ + @Test + public void contentLengthTest() { + // TODO: test contentLength + } + + /** + * Test the property 'mediaName' + */ + @Test + public void mediaNameTest() { + // TODO: test mediaName + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessageTest.java new file mode 100644 index 00000000..13744a70 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackMessageTest.java @@ -0,0 +1,144 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageDeliveredCallbackMessage + */ +public class MessageDeliveredCallbackMessageTest { + private final MessageDeliveredCallbackMessage model = new MessageDeliveredCallbackMessage(); + + /** + * Model tests for MessageDeliveredCallbackMessage + */ + @Test + public void testMessageDeliveredCallbackMessage() { + // TODO: test MessageDeliveredCallbackMessage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + // TODO: test owner + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackTest.java new file mode 100644 index 00000000..7e106923 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageDeliveredCallbackTest.java @@ -0,0 +1,82 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.MessageDeliveredCallbackMessage; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageDeliveredCallback + */ +public class MessageDeliveredCallbackTest { + private final MessageDeliveredCallback model = new MessageDeliveredCallback(); + + /** + * Model tests for MessageDeliveredCallback + */ + @Test + public void testMessageDeliveredCallback() { + // TODO: test MessageDeliveredCallback + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageDirectionEnumTest.java b/src/test/java/com/bandwidth/sdk/model/MessageDirectionEnumTest.java new file mode 100644 index 00000000..1b497d48 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageDirectionEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageDirectionEnum + */ +public class MessageDirectionEnumTest { + /** + * Model tests for MessageDirectionEnum + */ + @Test + public void testMessageDirectionEnum() { + // TODO: test MessageDirectionEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackMessageTest.java new file mode 100644 index 00000000..c30f5cca --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackMessageTest.java @@ -0,0 +1,144 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageFailedCallbackMessage + */ +public class MessageFailedCallbackMessageTest { + private final MessageFailedCallbackMessage model = new MessageFailedCallbackMessage(); + + /** + * Model tests for MessageFailedCallbackMessage + */ + @Test + public void testMessageFailedCallbackMessage() { + // TODO: test MessageFailedCallbackMessage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + // TODO: test owner + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackTest.java new file mode 100644 index 00000000..9d775ceb --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageFailedCallbackTest.java @@ -0,0 +1,90 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.MessageFailedCallbackMessage; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageFailedCallback + */ +public class MessageFailedCallbackTest { + private final MessageFailedCallback model = new MessageFailedCallback(); + + /** + * Model tests for MessageFailedCallback + */ + @Test + public void testMessageFailedCallback() { + // TODO: test MessageFailedCallback + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + + /** + * Test the property 'errorCode' + */ + @Test + public void errorCodeTest() { + // TODO: test errorCode + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageRequestTest.java b/src/test/java/com/bandwidth/sdk/model/MessageRequestTest.java new file mode 100644 index 00000000..f9207e76 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageRequestTest.java @@ -0,0 +1,112 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageRequest + */ +public class MessageRequestTest { + private final MessageRequest model = new MessageRequest(); + + /** + * Model tests for MessageRequest + */ + @Test + public void testMessageRequest() { + // TODO: test MessageRequest + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + + /** + * Test the property 'expiration' + */ + @Test + public void expirationTest() { + // TODO: test expiration + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackMessageTest.java b/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackMessageTest.java new file mode 100644 index 00000000..d36d1ad8 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackMessageTest.java @@ -0,0 +1,144 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageSendingCallbackMessage + */ +public class MessageSendingCallbackMessageTest { + private final MessageSendingCallbackMessage model = new MessageSendingCallbackMessage(); + + /** + * Model tests for MessageSendingCallbackMessage + */ + @Test + public void testMessageSendingCallbackMessage() { + // TODO: test MessageSendingCallbackMessage + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + // TODO: test owner + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackTest.java new file mode 100644 index 00000000..789a24d2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageSendingCallbackTest.java @@ -0,0 +1,82 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.MessageSendingCallbackMessage; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageSendingCallback + */ +public class MessageSendingCallbackTest { + private final MessageSendingCallback model = new MessageSendingCallback(); + + /** + * Model tests for MessageSendingCallback + */ + @Test + public void testMessageSendingCallback() { + // TODO: test MessageSendingCallback + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageStatusEnumTest.java b/src/test/java/com/bandwidth/sdk/model/MessageStatusEnumTest.java new file mode 100644 index 00000000..b7837c90 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageStatusEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageStatusEnum + */ +public class MessageStatusEnumTest { + /** + * Model tests for MessageStatusEnum + */ + @Test + public void testMessageStatusEnum() { + // TODO: test MessageStatusEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageTest.java b/src/test/java/com/bandwidth/sdk/model/MessageTest.java new file mode 100644 index 00000000..d53735a3 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageTest.java @@ -0,0 +1,142 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.LinkedHashSet; +import java.util.Set; +import com.bandwidth.sdk.model.MessageDirectionEnum; +import com.bandwidth.sdk.model.PriorityEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Message + */ +public class MessageTest { + private final Message model = new Message(); + + /** + * Model tests for Message + */ + @Test + public void testMessage() { + // TODO: test Message + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'owner' + */ + @Test + public void ownerTest() { + // TODO: test owner + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'time' + */ + @Test + public void timeTest() { + // TODO: test time + } + + /** + * Test the property 'segmentCount' + */ + @Test + public void segmentCountTest() { + // TODO: test segmentCount + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'media' + */ + @Test + public void mediaTest() { + // TODO: test media + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'priority' + */ + @Test + public void priorityTest() { + // TODO: test priority + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessageTypeEnumTest.java b/src/test/java/com/bandwidth/sdk/model/MessageTypeEnumTest.java new file mode 100644 index 00000000..90cfe62c --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessageTypeEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessageTypeEnum + */ +public class MessageTypeEnumTest { + /** + * Model tests for MessageTypeEnum + */ + @Test + public void testMessageTypeEnum() { + // TODO: test MessageTypeEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessagesListTest.java b/src/test/java/com/bandwidth/sdk/model/MessagesListTest.java new file mode 100644 index 00000000..08972acf --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessagesListTest.java @@ -0,0 +1,70 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.bandwidth.sdk.model.ListMessageItem; +import com.bandwidth.sdk.model.PageInfo; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessagesList + */ +public class MessagesListTest { + private final MessagesList model = new MessagesList(); + + /** + * Model tests for MessagesList + */ + @Test + public void testMessagesList() { + // TODO: test MessagesList + } + + /** + * Test the property 'totalCount' + */ + @Test + public void totalCountTest() { + // TODO: test totalCount + } + + /** + * Test the property 'pageInfo' + */ + @Test + public void pageInfoTest() { + // TODO: test pageInfo + } + + /** + * Test the property 'messages' + */ + @Test + public void messagesTest() { + // TODO: test messages + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessagingCodeResponseTest.java b/src/test/java/com/bandwidth/sdk/model/MessagingCodeResponseTest.java new file mode 100644 index 00000000..81452fe1 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessagingCodeResponseTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessagingCodeResponse + */ +public class MessagingCodeResponseTest { + private final MessagingCodeResponse model = new MessagingCodeResponse(); + + /** + * Model tests for MessagingCodeResponse + */ + @Test + public void testMessagingCodeResponse() { + // TODO: test MessagingCodeResponse + } + + /** + * Test the property 'messageId' + */ + @Test + public void messageIdTest() { + // TODO: test messageId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MessagingRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/MessagingRequestErrorTest.java new file mode 100644 index 00000000..d62d23cf --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MessagingRequestErrorTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MessagingRequestError + */ +public class MessagingRequestErrorTest { + private final MessagingRequestError model = new MessagingRequestError(); + + /** + * Model tests for MessagingRequestError + */ + @Test + public void testMessagingRequestError() { + // TODO: test MessagingRequestError + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MfaForbiddenRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/MfaForbiddenRequestErrorTest.java new file mode 100644 index 00000000..829d9b78 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MfaForbiddenRequestErrorTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MfaForbiddenRequestError + */ +public class MfaForbiddenRequestErrorTest { + private final MfaForbiddenRequestError model = new MfaForbiddenRequestError(); + + /** + * Model tests for MfaForbiddenRequestError + */ + @Test + public void testMfaForbiddenRequestError() { + // TODO: test MfaForbiddenRequestError + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MfaRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/MfaRequestErrorTest.java new file mode 100644 index 00000000..e21fcfc6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MfaRequestErrorTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MfaRequestError + */ +public class MfaRequestErrorTest { + private final MfaRequestError model = new MfaRequestError(); + + /** + * Model tests for MfaRequestError + */ + @Test + public void testMfaRequestError() { + // TODO: test MfaRequestError + } + + /** + * Test the property 'error' + */ + @Test + public void errorTest() { + // TODO: test error + } + + /** + * Test the property 'requestId' + */ + @Test + public void requestIdTest() { + // TODO: test requestId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestErrorTest.java new file mode 100644 index 00000000..051ac1f8 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/MfaUnauthorizedRequestErrorTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for MfaUnauthorizedRequestError + */ +public class MfaUnauthorizedRequestErrorTest { + private final MfaUnauthorizedRequestError model = new MfaUnauthorizedRequestError(); + + /** + * Model tests for MfaUnauthorizedRequestError + */ + @Test + public void testMfaUnauthorizedRequestError() { + // TODO: test MfaUnauthorizedRequestError + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/PageInfoTest.java b/src/test/java/com/bandwidth/sdk/model/PageInfoTest.java new file mode 100644 index 00000000..4e4f9270 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/PageInfoTest.java @@ -0,0 +1,74 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PageInfo + */ +public class PageInfoTest { + private final PageInfo model = new PageInfo(); + + /** + * Model tests for PageInfo + */ + @Test + public void testPageInfo() { + // TODO: test PageInfo + } + + /** + * Test the property 'prevPage' + */ + @Test + public void prevPageTest() { + // TODO: test prevPage + } + + /** + * Test the property 'nextPage' + */ + @Test + public void nextPageTest() { + // TODO: test nextPage + } + + /** + * Test the property 'prevPageToken' + */ + @Test + public void prevPageTokenTest() { + // TODO: test prevPageToken + } + + /** + * Test the property 'nextPageToken' + */ + @Test + public void nextPageTokenTest() { + // TODO: test nextPageToken + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/PriorityEnumTest.java b/src/test/java/com/bandwidth/sdk/model/PriorityEnumTest.java new file mode 100644 index 00000000..b1ad1b51 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/PriorityEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PriorityEnum + */ +public class PriorityEnumTest { + /** + * Model tests for PriorityEnum + */ + @Test + public void testPriorityEnum() { + // TODO: test PriorityEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/PublishPermissionsEnumTest.java b/src/test/java/com/bandwidth/sdk/model/PublishPermissionsEnumTest.java new file mode 100644 index 00000000..c9c35ff2 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/PublishPermissionsEnumTest.java @@ -0,0 +1,33 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for PublishPermissionsEnum + */ +public class PublishPermissionsEnumTest { + /** + * Model tests for PublishPermissionsEnum + */ + @Test + public void testPublishPermissionsEnum() { + // TODO: test PublishPermissionsEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/RecordingAvailableCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/RecordingAvailableCallbackTest.java new file mode 100644 index 00000000..04692cbb --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/RecordingAvailableCallbackTest.java @@ -0,0 +1,223 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RecordingAvailableCallback + */ +public class RecordingAvailableCallbackTest { + private final RecordingAvailableCallback model = new RecordingAvailableCallback(); + + /** + * Model tests for RecordingAvailableCallback + */ + @Test + public void testRecordingAvailableCallback() { + // TODO: test RecordingAvailableCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'channels' + */ + @Test + public void channelsTest() { + // TODO: test channels + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/RecordingCompleteCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/RecordingCompleteCallbackTest.java new file mode 100644 index 00000000..c7e09851 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/RecordingCompleteCallbackTest.java @@ -0,0 +1,223 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RecordingCompleteCallback + */ +public class RecordingCompleteCallbackTest { + private final RecordingCompleteCallback model = new RecordingCompleteCallback(); + + /** + * Model tests for RecordingCompleteCallback + */ + @Test + public void testRecordingCompleteCallback() { + // TODO: test RecordingCompleteCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'channels' + */ + @Test + public void channelsTest() { + // TODO: test channels + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/RecordingStateEnumTest.java b/src/test/java/com/bandwidth/sdk/model/RecordingStateEnumTest.java new file mode 100644 index 00000000..f9d35495 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/RecordingStateEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RecordingStateEnum + */ +public class RecordingStateEnumTest { + /** + * Model tests for RecordingStateEnum + */ + @Test + public void testRecordingStateEnum() { + // TODO: test RecordingStateEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/RedirectCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/RedirectCallbackTest.java new file mode 100644 index 00000000..5af3c975 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/RedirectCallbackTest.java @@ -0,0 +1,173 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RedirectCallback + */ +public class RedirectCallbackTest { + private final RedirectCallback model = new RedirectCallback(); + + /** + * Model tests for RedirectCallback + */ + @Test + public void testRedirectCallback() { + // TODO: test RedirectCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/RedirectMethodEnumTest.java b/src/test/java/com/bandwidth/sdk/model/RedirectMethodEnumTest.java new file mode 100644 index 00000000..e30b8b9b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/RedirectMethodEnumTest.java @@ -0,0 +1,34 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import io.swagger.annotations.ApiModel; +import com.google.gson.annotations.SerializedName; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for RedirectMethodEnum + */ +public class RedirectMethodEnumTest { + /** + * Model tests for RedirectMethodEnum + */ + @Test + public void testRedirectMethodEnum() { + // TODO: test RedirectMethodEnum + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/StirShakenTest.java b/src/test/java/com/bandwidth/sdk/model/StirShakenTest.java new file mode 100644 index 00000000..1f33ef07 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/StirShakenTest.java @@ -0,0 +1,66 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for StirShaken + */ +public class StirShakenTest { + private final StirShaken model = new StirShaken(); + + /** + * Model tests for StirShaken + */ + @Test + public void testStirShaken() { + // TODO: test StirShaken + } + + /** + * Test the property 'verstat' + */ + @Test + public void verstatTest() { + // TODO: test verstat + } + + /** + * Test the property 'attestationIndicator' + */ + @Test + public void attestationIndicatorTest() { + // TODO: test attestationIndicator + } + + /** + * Test the property 'originatingId' + */ + @Test + public void originatingIdTest() { + // TODO: test originatingId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TagTest.java b/src/test/java/com/bandwidth/sdk/model/TagTest.java new file mode 100644 index 00000000..39ef3cd4 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TagTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Tag + */ +public class TagTest { + private final Tag model = new Tag(); + + /** + * Model tests for Tag + */ + @Test + public void testTag() { + // TODO: test Tag + } + + /** + * Test the property 'key' + */ + @Test + public void keyTest() { + // TODO: test key + } + + /** + * Test the property 'value' + */ + @Test + public void valueTest() { + // TODO: test value + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TnLookupRequestErrorTest.java b/src/test/java/com/bandwidth/sdk/model/TnLookupRequestErrorTest.java new file mode 100644 index 00000000..4a8da6ba --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TnLookupRequestErrorTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TnLookupRequestError + */ +public class TnLookupRequestErrorTest { + private final TnLookupRequestError model = new TnLookupRequestError(); + + /** + * Model tests for TnLookupRequestError + */ + @Test + public void testTnLookupRequestError() { + // TODO: test TnLookupRequestError + } + + /** + * Test the property 'message' + */ + @Test + public void messageTest() { + // TODO: test message + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TranscribeRecordingTest.java b/src/test/java/com/bandwidth/sdk/model/TranscribeRecordingTest.java new file mode 100644 index 00000000..e0af0c28 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TranscribeRecordingTest.java @@ -0,0 +1,93 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import com.bandwidth.sdk.model.CallbackMethodEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TranscribeRecording + */ +public class TranscribeRecordingTest { + private final TranscribeRecording model = new TranscribeRecording(); + + /** + * Model tests for TranscribeRecording + */ + @Test + public void testTranscribeRecording() { + // TODO: test TranscribeRecording + } + + /** + * Test the property 'callbackUrl' + */ + @Test + public void callbackUrlTest() { + // TODO: test callbackUrl + } + + /** + * Test the property 'callbackMethod' + */ + @Test + public void callbackMethodTest() { + // TODO: test callbackMethod + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'callbackTimeout' + */ + @Test + public void callbackTimeoutTest() { + // TODO: test callbackTimeout + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TranscriptionAvailableCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/TranscriptionAvailableCallbackTest.java new file mode 100644 index 00000000..30ac1eb6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TranscriptionAvailableCallbackTest.java @@ -0,0 +1,216 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.FileFormatEnum; +import com.bandwidth.sdk.model.Transcription; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TranscriptionAvailableCallback + */ +public class TranscriptionAvailableCallbackTest { + private final TranscriptionAvailableCallback model = new TranscriptionAvailableCallback(); + + /** + * Model tests for TranscriptionAvailableCallback + */ + @Test + public void testTranscriptionAvailableCallback() { + // TODO: test TranscriptionAvailableCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'mediaUrl' + */ + @Test + public void mediaUrlTest() { + // TODO: test mediaUrl + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'recordingId' + */ + @Test + public void recordingIdTest() { + // TODO: test recordingId + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'duration' + */ + @Test + public void durationTest() { + // TODO: test duration + } + + /** + * Test the property 'fileFormat' + */ + @Test + public void fileFormatTest() { + // TODO: test fileFormat + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transcription' + */ + @Test + public void transcriptionTest() { + // TODO: test transcription + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TranscriptionListTest.java b/src/test/java/com/bandwidth/sdk/model/TranscriptionListTest.java new file mode 100644 index 00000000..61f91b5f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TranscriptionListTest.java @@ -0,0 +1,53 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import com.bandwidth.sdk.model.Transcription; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TranscriptionList + */ +public class TranscriptionListTest { + private final TranscriptionList model = new TranscriptionList(); + + /** + * Model tests for TranscriptionList + */ + @Test + public void testTranscriptionList() { + // TODO: test TranscriptionList + } + + /** + * Test the property 'transcripts' + */ + @Test + public void transcriptsTest() { + // TODO: test transcripts + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TranscriptionMetadataTest.java b/src/test/java/com/bandwidth/sdk/model/TranscriptionMetadataTest.java new file mode 100644 index 00000000..50182dab --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TranscriptionMetadataTest.java @@ -0,0 +1,75 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TranscriptionMetadata + */ +public class TranscriptionMetadataTest { + private final TranscriptionMetadata model = new TranscriptionMetadata(); + + /** + * Model tests for TranscriptionMetadata + */ + @Test + public void testTranscriptionMetadata() { + // TODO: test TranscriptionMetadata + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'completedTime' + */ + @Test + public void completedTimeTest() { + // TODO: test completedTime + } + + /** + * Test the property 'url' + */ + @Test + public void urlTest() { + // TODO: test url + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TranscriptionTest.java b/src/test/java/com/bandwidth/sdk/model/TranscriptionTest.java new file mode 100644 index 00000000..b4d78566 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TranscriptionTest.java @@ -0,0 +1,58 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for Transcription + */ +public class TranscriptionTest { + private final Transcription model = new Transcription(); + + /** + * Model tests for Transcription + */ + @Test + public void testTranscription() { + // TODO: test Transcription + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + // TODO: test text + } + + /** + * Test the property 'confidence' + */ + @Test + public void confidenceTest() { + // TODO: test confidence + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TransferAnswerCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/TransferAnswerCallbackTest.java new file mode 100644 index 00000000..52c92b9e --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TransferAnswerCallbackTest.java @@ -0,0 +1,165 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TransferAnswerCallback + */ +public class TransferAnswerCallbackTest { + private final TransferAnswerCallback model = new TransferAnswerCallback(); + + /** + * Model tests for TransferAnswerCallback + */ + @Test + public void testTransferAnswerCallback() { + // TODO: test TransferAnswerCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TransferCompleteCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/TransferCompleteCallbackTest.java new file mode 100644 index 00000000..5ddb2fa7 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TransferCompleteCallbackTest.java @@ -0,0 +1,189 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TransferCompleteCallback + */ +public class TransferCompleteCallbackTest { + private final TransferCompleteCallback model = new TransferCompleteCallback(); + + /** + * Model tests for TransferCompleteCallback + */ + @Test + public void testTransferCompleteCallback() { + // TODO: test TransferCompleteCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + + /** + * Test the property 'cause' + */ + @Test + public void causeTest() { + // TODO: test cause + } + + /** + * Test the property 'errorMessage' + */ + @Test + public void errorMessageTest() { + // TODO: test errorMessage + } + + /** + * Test the property 'errorId' + */ + @Test + public void errorIdTest() { + // TODO: test errorId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/TransferDisconnectCallbackTest.java b/src/test/java/com/bandwidth/sdk/model/TransferDisconnectCallbackTest.java new file mode 100644 index 00000000..355a0428 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/TransferDisconnectCallbackTest.java @@ -0,0 +1,205 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.time.OffsetDateTime; +import com.bandwidth.sdk.model.CallDirectionEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for TransferDisconnectCallback + */ +public class TransferDisconnectCallbackTest { + private final TransferDisconnectCallback model = new TransferDisconnectCallback(); + + /** + * Model tests for TransferDisconnectCallback + */ + @Test + public void testTransferDisconnectCallback() { + // TODO: test TransferDisconnectCallback + } + + /** + * Test the property 'eventType' + */ + @Test + public void eventTypeTest() { + // TODO: test eventType + } + + /** + * Test the property 'eventTime' + */ + @Test + public void eventTimeTest() { + // TODO: test eventTime + } + + /** + * Test the property 'accountId' + */ + @Test + public void accountIdTest() { + // TODO: test accountId + } + + /** + * Test the property 'applicationId' + */ + @Test + public void applicationIdTest() { + // TODO: test applicationId + } + + /** + * Test the property 'from' + */ + @Test + public void fromTest() { + // TODO: test from + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'direction' + */ + @Test + public void directionTest() { + // TODO: test direction + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + + /** + * Test the property 'callUrl' + */ + @Test + public void callUrlTest() { + // TODO: test callUrl + } + + /** + * Test the property 'parentCallId' + */ + @Test + public void parentCallIdTest() { + // TODO: test parentCallId + } + + /** + * Test the property 'enqueuedTime' + */ + @Test + public void enqueuedTimeTest() { + // TODO: test enqueuedTime + } + + /** + * Test the property 'startTime' + */ + @Test + public void startTimeTest() { + // TODO: test startTime + } + + /** + * Test the property 'answerTime' + */ + @Test + public void answerTimeTest() { + // TODO: test answerTime + } + + /** + * Test the property 'endTime' + */ + @Test + public void endTimeTest() { + // TODO: test endTime + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + + /** + * Test the property 'transferCallerId' + */ + @Test + public void transferCallerIdTest() { + // TODO: test transferCallerId + } + + /** + * Test the property 'transferTo' + */ + @Test + public void transferToTest() { + // TODO: test transferTo + } + + /** + * Test the property 'cause' + */ + @Test + public void causeTest() { + // TODO: test cause + } + + /** + * Test the property 'errorMessage' + */ + @Test + public void errorMessageTest() { + // TODO: test errorMessage + } + + /** + * Test the property 'errorId' + */ + @Test + public void errorIdTest() { + // TODO: test errorId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/UpdateCallRecordingTest.java b/src/test/java/com/bandwidth/sdk/model/UpdateCallRecordingTest.java new file mode 100644 index 00000000..a0449844 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/UpdateCallRecordingTest.java @@ -0,0 +1,51 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import com.bandwidth.sdk.model.RecordingStateEnum; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UpdateCallRecording + */ +public class UpdateCallRecordingTest { + private final UpdateCallRecording model = new UpdateCallRecording(); + + /** + * Model tests for UpdateCallRecording + */ + @Test + public void testUpdateCallRecording() { + // TODO: test UpdateCallRecording + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + // TODO: test state + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/UpdateCallTest.java b/src/test/java/com/bandwidth/sdk/model/UpdateCallTest.java new file mode 100644 index 00000000..d7570a06 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/UpdateCallTest.java @@ -0,0 +1,126 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import com.bandwidth.sdk.model.CallStateEnum; +import com.bandwidth.sdk.model.RedirectMethodEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UpdateCall + */ +public class UpdateCallTest { + private final UpdateCall model = new UpdateCall(); + + /** + * Model tests for UpdateCall + */ + @Test + public void testUpdateCall() { + // TODO: test UpdateCall + } + + /** + * Test the property 'state' + */ + @Test + public void stateTest() { + // TODO: test state + } + + /** + * Test the property 'redirectUrl' + */ + @Test + public void redirectUrlTest() { + // TODO: test redirectUrl + } + + /** + * Test the property 'redirectMethod' + */ + @Test + public void redirectMethodTest() { + // TODO: test redirectMethod + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'redirectFallbackUrl' + */ + @Test + public void redirectFallbackUrlTest() { + // TODO: test redirectFallbackUrl + } + + /** + * Test the property 'redirectFallbackMethod' + */ + @Test + public void redirectFallbackMethodTest() { + // TODO: test redirectFallbackMethod + } + + /** + * Test the property 'fallbackUsername' + */ + @Test + public void fallbackUsernameTest() { + // TODO: test fallbackUsername + } + + /** + * Test the property 'fallbackPassword' + */ + @Test + public void fallbackPasswordTest() { + // TODO: test fallbackPassword + } + + /** + * Test the property 'tag' + */ + @Test + public void tagTest() { + // TODO: test tag + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/UpdateConferenceMemberTest.java b/src/test/java/com/bandwidth/sdk/model/UpdateConferenceMemberTest.java new file mode 100644 index 00000000..02e2f24b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/UpdateConferenceMemberTest.java @@ -0,0 +1,69 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UpdateConferenceMember + */ +public class UpdateConferenceMemberTest { + private final UpdateConferenceMember model = new UpdateConferenceMember(); + + /** + * Model tests for UpdateConferenceMember + */ + @Test + public void testUpdateConferenceMember() { + // TODO: test UpdateConferenceMember + } + + /** + * Test the property 'mute' + */ + @Test + public void muteTest() { + // TODO: test mute + } + + /** + * Test the property 'hold' + */ + @Test + public void holdTest() { + // TODO: test hold + } + + /** + * Test the property 'callIdsToCoach' + */ + @Test + public void callIdsToCoachTest() { + // TODO: test callIdsToCoach + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/UpdateConferenceTest.java b/src/test/java/com/bandwidth/sdk/model/UpdateConferenceTest.java new file mode 100644 index 00000000..561fd040 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/UpdateConferenceTest.java @@ -0,0 +1,118 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.net.URI; +import com.bandwidth.sdk.model.ConferenceStateEnum; +import com.bandwidth.sdk.model.RedirectMethodEnum; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for UpdateConference + */ +public class UpdateConferenceTest { + private final UpdateConference model = new UpdateConference(); + + /** + * Model tests for UpdateConference + */ + @Test + public void testUpdateConference() { + // TODO: test UpdateConference + } + + /** + * Test the property 'status' + */ + @Test + public void statusTest() { + // TODO: test status + } + + /** + * Test the property 'redirectUrl' + */ + @Test + public void redirectUrlTest() { + // TODO: test redirectUrl + } + + /** + * Test the property 'redirectMethod' + */ + @Test + public void redirectMethodTest() { + // TODO: test redirectMethod + } + + /** + * Test the property 'username' + */ + @Test + public void usernameTest() { + // TODO: test username + } + + /** + * Test the property 'password' + */ + @Test + public void passwordTest() { + // TODO: test password + } + + /** + * Test the property 'redirectFallbackUrl' + */ + @Test + public void redirectFallbackUrlTest() { + // TODO: test redirectFallbackUrl + } + + /** + * Test the property 'redirectFallbackMethod' + */ + @Test + public void redirectFallbackMethodTest() { + // TODO: test redirectFallbackMethod + } + + /** + * Test the property 'fallbackUsername' + */ + @Test + public void fallbackUsernameTest() { + // TODO: test fallbackUsername + } + + /** + * Test the property 'fallbackPassword' + */ + @Test + public void fallbackPasswordTest() { + // TODO: test fallbackPassword + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/VerifyCodeRequestTest.java b/src/test/java/com/bandwidth/sdk/model/VerifyCodeRequestTest.java new file mode 100644 index 00000000..c3e6cda4 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/VerifyCodeRequestTest.java @@ -0,0 +1,75 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.math.BigDecimal; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for VerifyCodeRequest + */ +public class VerifyCodeRequestTest { + private final VerifyCodeRequest model = new VerifyCodeRequest(); + + /** + * Model tests for VerifyCodeRequest + */ + @Test + public void testVerifyCodeRequest() { + // TODO: test VerifyCodeRequest + } + + /** + * Test the property 'to' + */ + @Test + public void toTest() { + // TODO: test to + } + + /** + * Test the property 'scope' + */ + @Test + public void scopeTest() { + // TODO: test scope + } + + /** + * Test the property 'expirationTimeInMinutes' + */ + @Test + public void expirationTimeInMinutesTest() { + // TODO: test expirationTimeInMinutes + } + + /** + * Test the property 'code' + */ + @Test + public void codeTest() { + // TODO: test code + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/VerifyCodeResponseTest.java b/src/test/java/com/bandwidth/sdk/model/VerifyCodeResponseTest.java new file mode 100644 index 00000000..0f3426b4 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/VerifyCodeResponseTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for VerifyCodeResponse + */ +public class VerifyCodeResponseTest { + private final VerifyCodeResponse model = new VerifyCodeResponse(); + + /** + * Model tests for VerifyCodeResponse + */ + @Test + public void testVerifyCodeResponse() { + // TODO: test VerifyCodeResponse + } + + /** + * Test the property 'valid' + */ + @Test + public void validTest() { + // TODO: test valid + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/VoiceApiErrorTest.java b/src/test/java/com/bandwidth/sdk/model/VoiceApiErrorTest.java new file mode 100644 index 00000000..b2a33c76 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/VoiceApiErrorTest.java @@ -0,0 +1,67 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for VoiceApiError + */ +public class VoiceApiErrorTest { + private final VoiceApiError model = new VoiceApiError(); + + /** + * Model tests for VoiceApiError + */ + @Test + public void testVoiceApiError() { + // TODO: test VoiceApiError + } + + /** + * Test the property 'type' + */ + @Test + public void typeTest() { + // TODO: test type + } + + /** + * Test the property 'description' + */ + @Test + public void descriptionTest() { + // TODO: test description + } + + /** + * Test the property 'id' + */ + @Test + public void idTest() { + // TODO: test id + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/VoiceCodeResponseTest.java b/src/test/java/com/bandwidth/sdk/model/VoiceCodeResponseTest.java new file mode 100644 index 00000000..844ad78f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/VoiceCodeResponseTest.java @@ -0,0 +1,50 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + + +/** + * Model tests for VoiceCodeResponse + */ +public class VoiceCodeResponseTest { + private final VoiceCodeResponse model = new VoiceCodeResponse(); + + /** + * Model tests for VoiceCodeResponse + */ + @Test + public void testVoiceCodeResponse() { + // TODO: test VoiceCodeResponse + } + + /** + * Test the property 'callId' + */ + @Test + public void callIdTest() { + // TODO: test callId + } + +} diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/BridgeVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/BridgeVerbTest.java new file mode 100644 index 00000000..a77d94bf --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/BridgeVerbTest.java @@ -0,0 +1,37 @@ +/** + * + * Unit tests for Bridge Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Bridge; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +public class BridgeVerbTest { + /** + * Setting up Variables + */ + Bridge bridge = new Bridge().builder() + .targetCallId("+19198675309") + .bridgeCompleteUrl("https://example.com") + .tag("test") + .build(); + + @Test + public void bridgeVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "+19198675309"; + + assertThat(new Bxml().with(bridge).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/BxmlVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/BxmlVerbTest.java new file mode 100644 index 00000000..b4d96f0c --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/BxmlVerbTest.java @@ -0,0 +1,62 @@ +/** + * Unit tests for Bxml Verb Class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Forward; +import com.bandwidth.sdk.model.bxml.Tag; +import com.bandwidth.sdk.model.bxml.Pause; +import com.bandwidth.sdk.model.bxml.SendDtmf; +import com.bandwidth.sdk.model.DiversionReason; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.contains; +public class BxmlVerbTest { + + /** + * Setting up Variables + */ + + Bxml bxml = new Bxml().with(new Tag("Test")); + Tag tag = new Tag("Test Tag Content"); + Bxml bxml2 = new Bxml().with(tag); + + @Test + public void toBxmlWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + Bxml bxml = new Bxml().with(new Tag("Test")); + Tag tag = new Tag("Test Tag Content"); + Bxml bxml2 = new Bxml().with(tag); + String expectedBxml = "Test"; + String expectedBxml2 = "Test Tag Content"; + + assertThat(bxml.toBxml(jaxbContext), is(expectedBxml)); + assertThat(bxml2.toBxml(jaxbContext), is(expectedBxml2)); + }; + + @Test + public void withWorks() { + Pause pause = new Pause(2d); + Bxml bxml = new Bxml().with(pause); + assertThat(bxml.getVerbs(), contains(pause)); + } + + @Test + public void withVerbsWorks() { + Pause pause = new Pause(2d); + SendDtmf sendDtmf = new SendDtmf("1"); + Bxml bxml = new Bxml().withVerbs(pause, sendDtmf); + assertThat(bxml.getVerbs().get(0), is(pause)); + assertThat(bxml.getVerbs().get(1), is(sendDtmf)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/ConferenceVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ConferenceVerbTest.java new file mode 100644 index 00000000..1b167afc --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ConferenceVerbTest.java @@ -0,0 +1,50 @@ +/** + * + * Unit tests for Conference Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Conference; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class ConferenceVerbTest { + /** + * Setting up Variables + */ + Conference conference = new Conference().builder() + .name("conf1") + .mute(true) + .hold(false) + .callIdsToCoach("example-call-id") + .conferenceEventUrl("example.com/eventurl") + .conferenceEventMethod("POST") + .conferenceEventFallbackUrl("backupexample.com/eventurl") + .conferenceEventFallbackMethod("POST") + .username("user") + .password("pass") + .fallbackUsername("user") + .fallbackPassword("pass") + .tag("tag") + .callbackTimeout(5d) + .build(); + + @Test + public void conferenceVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "conf1"; + + assertThat(new Bxml().with(conference).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/ForwardVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ForwardVerbTest.java new file mode 100644 index 00000000..596d1125 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ForwardVerbTest.java @@ -0,0 +1,44 @@ +/** + * + * Unit tests for Forward Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Forward; +import com.bandwidth.sdk.model.DiversionReason; +import com.bandwidth.sdk.model.DiversionTreatment; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class ForwardVerbTest { + /** + * Setting up Variables + */ + Forward forward = new Forward().builder() + .to("+19195554321") + .from("19195554322") + .callTimeout(15d) + .diversionTreatment(DiversionTreatment.PROPAGATE) + .diversionReason(DiversionReason.AWAY) + .uui("93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt") + .build(); + + @Test + public void forwardVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(forward).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/GatherVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/GatherVerbTest.java new file mode 100644 index 00000000..5e0b7baf --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/GatherVerbTest.java @@ -0,0 +1,59 @@ +/** + * + * Unit tests for Gather Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Gather; +import com.bandwidth.sdk.model.bxml.SpeakSentence; +import com.bandwidth.sdk.model.bxml.PlayAudio; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class GatherVerbTest { + /** + * Setting up Variables + */ + SpeakSentence speakSentence = new SpeakSentence("Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished."); + PlayAudio playAudio = new PlayAudio().builder() + .audioUri("test.com") + .build(); + Gather gather = new Gather().builder() + .gatherUrl("test.com") + .gatherMethod("POST") + .gatherFallbackUrl("fallback-test.com") + .gatherFallbackMethod("GET") + .username("user") + .password("pass") + .fallbackUsername("user") + .fallbackPassword("pass") + .tag("tag") + .terminatingDigits("2") + .maxDigits(5) + .interDigitTimeout(1d) + .firstDigitTimeout(3d) + .repeatCount(2) + .children(List.of(playAudio, speakSentence)) + .build(); + + @Test + public void gatherVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "test.comHello. Your number is <say-as interpret-as=\"telephone\">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished."; + + assertThat(new Bxml().with(gather).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/HangupVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/HangupVerbTest.java new file mode 100644 index 00000000..c0dbafe3 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/HangupVerbTest.java @@ -0,0 +1,29 @@ +/** + * + * Unit tests for Hangup Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Hangup; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +public class HangupVerbTest { + + @Test + public void hangupVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new Hangup()).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseRecordingVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseRecordingVerbTest.java new file mode 100644 index 00000000..2e746855 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseRecordingVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for PauseRecording Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.PauseRecording; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class PauseRecordingVerbTest { + + @Test + public void pauseRecordingVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new PauseRecording()).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseVerbTest.java new file mode 100644 index 00000000..ee63c4e5 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PauseVerbTest.java @@ -0,0 +1,29 @@ +/** + * + * Unit tests for Pause Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Pause; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +public class PauseVerbTest { + + @Test + public void pauseVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new Pause(2d)).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/PlayAudioVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PlayAudioVerbTest.java new file mode 100644 index 00000000..ca68370e --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/PlayAudioVerbTest.java @@ -0,0 +1,39 @@ +/** + * + * Unit tests for PlayAudio Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.PlayAudio; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class PlayAudioVerbTest { + /** + * Setting up Variables + */ + PlayAudio playAudio = new PlayAudio().builder() + .audioUri("test.com") + .username("user") + .password("pass") + .build(); + + @Test + public void playAudioVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "test.com"; + + assertThat(new Bxml().with(playAudio).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/RecordVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RecordVerbTest.java new file mode 100644 index 00000000..702d24bd --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RecordVerbTest.java @@ -0,0 +1,37 @@ +/** + * + * Unit tests for Record Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Record; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class RecordVerbTest { + /** + * Setting up Variables + */ + Record record = new Record().builder() + .maxDuration(10) + .build(); + + @Test + public void recordVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(record).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/RedirectVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RedirectVerbTest.java new file mode 100644 index 00000000..922935f3 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RedirectVerbTest.java @@ -0,0 +1,39 @@ +/** + * + * Unit tests for Redirect Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Redirect; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class RedirectVerbTest { + /** + * Setting up Variables + */ + Redirect redirect = new Redirect().builder() + .redirectUrl("https://example.com/redirect") + .redirectFallbackUrl("fallback-url.com") + .redirectMethod("POST") + .build(); + + @Test + public void redirectVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(redirect).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResponseVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResponseVerbTest.java new file mode 100644 index 00000000..59efd373 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResponseVerbTest.java @@ -0,0 +1,63 @@ +/** + * Unit tests for Response Verb Class + * + * @throws JAXBException if the test fails + */ + + package com.bandwidth.sdk.model.unit.bxml; + + import com.bandwidth.sdk.model.bxml.Response; + import com.bandwidth.sdk.model.bxml.Forward; + import com.bandwidth.sdk.model.bxml.Tag; + import com.bandwidth.sdk.model.bxml.Pause; + import com.bandwidth.sdk.model.bxml.SendDtmf; + import com.bandwidth.sdk.model.DiversionReason; + + import jakarta.xml.bind.JAXBContext; + import jakarta.xml.bind.JAXBException; + + import org.junit.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.is; + import static org.hamcrest.Matchers.contains; + import static org.hamcrest.Matchers.containsString;; + public class ResponseVerbTest { + + /** + * Setting up Variables + */ + + Response response = new Response().with(new Tag("Test")); + Tag tag = new Tag("Test Tag Content"); + Response bxml2 = new Response().with(tag); + + @Test + public void toBxmlWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Response.class); + Response response = new Response().with(new Tag("Test")); + Tag tag = new Tag("Test Tag Content"); + Response response2 = new Response().with(tag); + String expectedBxml = "Test"; + String expectedBxml2 = "Test Tag Content"; + + assertThat(response.toBxml(jaxbContext), is(expectedBxml)); + assertThat(response2.toBxml(jaxbContext), is(expectedBxml2)); + }; + + @Test + public void withWorks() { + Pause pause = new Pause(2d); + Response response = new Response().with(pause); + assertThat(response.getVerbs(), contains(pause)); + } + + @Test + public void withVerbsWorks() { + Pause pause = new Pause(2d); + SendDtmf sendDtmf = new SendDtmf("1"); + Response response = new Response().withVerbs(pause, sendDtmf); + assertThat(response.getVerbs().get(0), is(pause)); + assertThat(response.getVerbs().get(1), is(sendDtmf)); + } + }; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResumeRecordingVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResumeRecordingVerbTest.java new file mode 100644 index 00000000..cd379239 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/ResumeRecordingVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for ResumeRecording Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.ResumeRecording; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class ResumeRecordingVerbTest { + + @Test + public void resumeRecordingVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new ResumeRecording()).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/RingVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RingVerbTest.java new file mode 100644 index 00000000..53f03420 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/RingVerbTest.java @@ -0,0 +1,29 @@ +/** + * + * Unit tests for Ring Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Ring; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +public class RingVerbTest { + + @Test + public void ringVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new Ring(30d, true)).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/SendDtmfVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/SendDtmfVerbTest.java new file mode 100644 index 00000000..5cd533b6 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/SendDtmfVerbTest.java @@ -0,0 +1,29 @@ +/** + * + * Unit tests for SendDtmf Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.SendDtmf; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +public class SendDtmfVerbTest { + + @Test + public void sendDtmfVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "1234"; + + assertThat(new Bxml().with(new SendDtmf("1234", 3,5)).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/SpeakSentenceVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/SpeakSentenceVerbTest.java new file mode 100644 index 00000000..127e5f99 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/SpeakSentenceVerbTest.java @@ -0,0 +1,47 @@ +/** + * + * Unit tests for SpeakSentence Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.SpeakSentence; +import com.bandwidth.sdk.model.bxml.utils.TtsGender; +import com.bandwidth.sdk.model.bxml.utils.TtsLocale; + + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class SpeakSentenceVerbTest { + /** + * Setting up Variables + */ + String sentence = "Hello. Your number is asdf, lets play a game. What is 10 + 3. Press the pound key when finished."; + + SpeakSentence speakSentence = new SpeakSentence().builder() + .innerTags(List.of(sentence)) + .locale(TtsLocale.EN_UK) + .gender(TtsGender.FEMALE) + .build(); + + + @Test + public void speakSentenceVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "Hello. Your number is <say-as interpret-as=\"telephone\">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished."; + + assertThat(new Bxml().with(speakSentence).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartGatherVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartGatherVerbTest.java new file mode 100644 index 00000000..aee87abc --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartGatherVerbTest.java @@ -0,0 +1,44 @@ +/** + * + * Unit tests for StartGather Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StartGather; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class StartGatherVerbTest { + /** + * Setting up Variables + */ + StartGather startGather = new StartGather().builder() + .dtmfUrl("https://example.com/startgather") + .dtmfMethod("POST") + .username("user") + .password("pass") + .tag("tag") + .build(); + + + @Test + public void startGatherVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(startGather).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartRecordingVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartRecordingVerbTest.java new file mode 100644 index 00000000..29559551 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartRecordingVerbTest.java @@ -0,0 +1,49 @@ +/** + * + * Unit tests for StartRecording Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StartRecording; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class StartRecordingVerbTest { + /** + * Setting up Variables + */ + StartRecording startRecording = new StartRecording().builder() + .recordingAvailableUrl("https://example.com") + .recordingAvailableMethod("POST") + .transcribe(true) + .transcriptionAvailableUrl("transcription-example.com") + .recordingAvailableMethod("POST") + .username("user") + .password("pass") + .tag("tag") + .fileFormat("wav") + .multiChannel(true) + .build(); + + + @Test + public void startRecordingVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(startRecording).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartStreamVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartStreamVerbTest.java new file mode 100644 index 00000000..40ac434f --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartStreamVerbTest.java @@ -0,0 +1,57 @@ +/** + * + * Unit tests for StartStream Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StartStream; +import com.bandwidth.sdk.model.bxml.StreamParam; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class StartStreamVerbTest { + /** + * Setting up Variables + */ + StreamParam streamParam1 = new StreamParam().builder() + .name("name1") + .value("value1") + .build(); + StreamParam streamParam2 = new StreamParam().builder() + .name("name2") + .value("value2") + .build(); + StartStream startStream = new StartStream().builder() + .name("stream1") + .tracks(CallDirectionEnum.INBOUND) + .destination("testurl.com") + .streamEventUrl("eventurl.com") + .streamEventMethod("POST") + .username("user") + .password("pass") + .streamParams(List.of(streamParam1, streamParam2)) + .build(); + + + @Test + public void startStreamVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(startStream).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartTranscriptionVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartTranscriptionVerbTest.java new file mode 100644 index 00000000..d4a8be72 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StartTranscriptionVerbTest.java @@ -0,0 +1,57 @@ +/** + * + * Unit tests for StartTranscription Verb class + * + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.CallDirectionEnum; +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StartTranscription; +import com.bandwidth.sdk.model.bxml.CustomParam; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class StartTranscriptionVerbTest { + /** + * Setting up Variables + */ + CustomParam customParam1 = new CustomParam().builder() + .name("name1") + .value("value1") + .build(); + CustomParam customParam2 = new CustomParam().builder() + .name("name2") + .value("value2") + .build(); + StartTranscription startTranscription = new StartTranscription().builder() + .name("test_transcription") + .tracks(CallDirectionEnum.INBOUND) + .destination("testurl.com") + .transcriptionEventUrl("eventurl.com") + .transcriptionEventMethod("POST") + .username("user") + .password("pass") + .customParams(List.of(customParam1, customParam2)) + .build(); + + + @Test + public void startTranscriptionVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(startTranscription).toBxml(jaxbContext), is(expectedBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopGatherVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopGatherVerbTest.java new file mode 100644 index 00000000..ab5d59ed --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopGatherVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for StopGather Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StopGather; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class StopGatherVerbTest { + + @Test + public void stopGatherVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new StopGather()).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopRecordingVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopRecordingVerbTest.java new file mode 100644 index 00000000..d8c18d8e --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopRecordingVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for StopRecording Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StopRecording; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class StopRecordingVerbTest { + + @Test + public void stopRecordingVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new StopRecording()).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopStreamVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopStreamVerbTest.java new file mode 100644 index 00000000..80ae2442 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopStreamVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for StopStream Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StopStream; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class StopStreamVerbTest { + + @Test + public void stopStreamVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new StopStream("name")).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopTranscriptionVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopTranscriptionVerbTest.java new file mode 100644 index 00000000..3339c18b --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/StopTranscriptionVerbTest.java @@ -0,0 +1,30 @@ +/** + * + * Unit tests for StopTranscription Verb class + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.StopTranscription; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class StopTranscriptionVerbTest { + + @Test + public void stopTranscriptionVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = ""; + + assertThat(new Bxml().with(new StopTranscription("name")).toBxml(jaxbContext), is(expectedBxml)); + }; +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/TagVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TagVerbTest.java new file mode 100644 index 00000000..e83f9c92 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TagVerbTest.java @@ -0,0 +1,29 @@ +/** + * + * Unit tests for Tag Verb class + * + * @throws JAXBException if the test fails + */ + + package com.bandwidth.sdk.model.unit.bxml; + + import com.bandwidth.sdk.model.bxml.Bxml; + import com.bandwidth.sdk.model.bxml.Tag; + + import jakarta.xml.bind.JAXBContext; + import jakarta.xml.bind.JAXBException; + + import org.junit.Test; + + import static org.hamcrest.MatcherAssert.assertThat; + import static org.hamcrest.Matchers.is; + public class TagVerbTest { + + @Test + public void tagVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedBxml = "Tag Test Content"; + + assertThat(new Bxml().with(new Tag("Tag Test Content")).toBxml(jaxbContext), is(expectedBxml)); + }; + }; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/TransferVerbTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TransferVerbTest.java new file mode 100644 index 00000000..44bc4225 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TransferVerbTest.java @@ -0,0 +1,65 @@ +/** + * + * Unit tests for Transfer Verb class + * Because they are part of the Transfer Verb, there are also tests for PhoneNumber and SipURI + * + * @throws JAXBException if the test fails + */ + +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.Bxml; +import com.bandwidth.sdk.model.bxml.Transfer; +import com.bandwidth.sdk.model.bxml.PhoneNumber; +import com.bandwidth.sdk.model.bxml.SipUri; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import java.util.List; + +public class TransferVerbTest { + /** + * Setting up Variables + */ + SipUri sipUri = new SipUri().builder() + .uri("sip@bw.com") + .uui("test") + .transferAnswerUrl("https://example.com/webhooks/transfer_answer") + .tag("test") + .transferAnswerMethod("POST") + .build(); + PhoneNumber phonenumber = new PhoneNumber().builder() + .number("+19195551234") + .transferAnswerUrl("https://example.com/webhooks/transfer_answer") + .tag("test") + .transferAnswerMethod("POST") + .build(); + Transfer transfer1 = new Transfer().builder() + .callTimeout(15d) + .destinations(List.of(sipUri)) + .transferCallerId("+19195554321") + .tag("test") + .build(); + Transfer transfer2 = new Transfer().builder() + .callTimeout(15d) + .destinations(List.of(phonenumber)) + .transferCallerId("+19195554321") + .tag("test") + .build(); + + @Test + public void transferVerbWorks() throws JAXBException { + JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); + String expectedSipUriBxml = "sip@bw.com"; + String expectedPhoneNumberBxml = "+19195551234"; + + assertThat(new Bxml().with(transfer1).toBxml(jaxbContext), is(expectedSipUriBxml)); + assertThat(new Bxml().with(transfer2).toBxml(jaxbContext), is(expectedPhoneNumberBxml)); + } +}; diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsGenderTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsGenderTest.java new file mode 100644 index 00000000..c37ce20a --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsGenderTest.java @@ -0,0 +1,33 @@ +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.utils.TtsGender; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.CoreMatchers.*; + +import org.junit.Test; + +public class TtsGenderTest { + + @Test + public void resolveMaleGender() { + assertThat(TtsGender.resolve("male"), is(TtsGender.MALE)); + } + + @Test + public void resolveFemaleGender() { + assertThat(TtsGender.resolve("female"), is(TtsGender.FEMALE)); + } + + @Test + public void nonsenseResolvesToNull() { + assertThat(TtsGender.resolve("asdf"), is(nullValue())); + } + + @Test + public void stringValidation() { + assertThat(TtsGender.FEMALE.toString(), is("female")); + + } +} diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsLocaleTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsLocaleTest.java new file mode 100644 index 00000000..34347448 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsLocaleTest.java @@ -0,0 +1,38 @@ +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.utils.TtsLocale; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.CoreMatchers.*; + + +import org.junit.Test; + +public class TtsLocaleTest { + + @Test + public void resolveEnLocale() { + assertThat(TtsLocale.resolve("en_US"), is(TtsLocale.EN_US)); + } + + @Test + public void resolveJaLocale() { + assertThat(TtsLocale.resolve("ja"), is(TtsLocale.JA)); + } + + @Test + public void resolveEsLocale() { + assertThat(TtsLocale.resolve("es_MX"), is(TtsLocale.ES_MX)); + } + + @Test + public void invalidResolvesToNull() { + assertThat(TtsLocale.resolve("ha"), is(nullValue())); + } + + @Test + public void stringValidation() { + assertThat(TtsLocale.EN_US.toString(), is("en_US")); + } +} diff --git a/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsVoiceTest.java b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsVoiceTest.java new file mode 100644 index 00000000..c29dad47 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/model/unit/bxml/TtsVoiceTest.java @@ -0,0 +1,48 @@ +package com.bandwidth.sdk.model.unit.bxml; + +import com.bandwidth.sdk.model.bxml.utils.TtsGender; +import com.bandwidth.sdk.model.bxml.utils.TtsLocale; +import com.bandwidth.sdk.model.bxml.utils.TtsVoice; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.CoreMatchers.*; + + +import org.junit.Test; + +public class TtsVoiceTest { + + @Test + public void resolveOurName1() { + assertThat(TtsVoice.fromOurName("susan"), is(TtsVoice.SUSAN)); + } + @Test + public void resolveOurName() { + assertThat(TtsVoice.fromOurName("paul"), is(TtsVoice.PAUL)); + } + + @Test + public void nonsenseResolvesToNull() { + assertThat(TtsVoice.fromOurName("Blahblah"), is(nullValue())); + } + + @Test + public void providerName() { + assertThat(TtsVoice.SUSAN.getProviderName(), is("Kimberly")); + } + + void inferFromGenderAndLocale() { + assertThat(TtsVoice.resolveGenderLocale(TtsGender.FEMALE, TtsLocale.EN_US), is(TtsVoice.SUSAN)); + } + + @Test + public void inferFromNullLocaleIsNull() { + assertThat(TtsVoice.resolveGenderLocale(TtsGender.FEMALE, null), is(nullValue())); + } + + @Test + public void toStringWorks() { + assertThat(TtsVoice.SUSAN.toString(), is("susan")); + } +} diff --git a/src/test/java/com/bandwidth/sdk/utils/CallCleanup.java b/src/test/java/com/bandwidth/sdk/utils/CallCleanup.java new file mode 100644 index 00000000..b34c0387 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/utils/CallCleanup.java @@ -0,0 +1,95 @@ +package com.bandwidth.sdk.utils; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +import com.bandwidth.sdk.api.CallsApiTest; +import com.bandwidth.sdk.api.ConferencesApiTest; +import com.bandwidth.sdk.api.RecordingsApiTest; +import com.bandwidth.sdk.model.CallStateEnum; +import com.bandwidth.sdk.model.UpdateCall; +import com.bandwidth.sdk.ApiException; +import com.bandwidth.sdk.ApiResponse; + +import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; + +public class CallCleanup { + private static int TEST_SLEEP = 5; + + /** + * Ensure that all CallIds inside of the callIdList have been hung up + * + * @param callIdList List of Bandwidth call ID's + */ + public static final void Cleanup(CallsApiTest testClass, List callIdList) throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + + if (!callIdList.isEmpty()) { + try { + testClass.Basic.setUsername(BW_USERNAME); + testClass.Basic.setPassword(BW_PASSWORD); + for (int i = 0; i < callIdList.size(); i++) { + String callState = testClass.api.getCallState(BW_ACCOUNT_ID, callIdList.get(i).toString()) + .getState(); + if (!callState.equalsIgnoreCase("disconnected")) { + UpdateCall updateCallBody = new UpdateCall(); + updateCallBody.setState(CallStateEnum.COMPLETED); + ApiResponse response = testClass.api.updateCallWithHttpInfo(BW_ACCOUNT_ID, + callIdList.get(i), + updateCallBody); + } + } + } catch (ApiException e) { + System.out.println("API Error: " + e.toString()); + throw new Exception("Failed to terminate all calls: [" + callIdList.toString() + "]"); + } + } + } + + /** + * Ensure that the call has been hung up + * + * @param callId Bandwidth call ID + */ + public static final void Cleanup(ConferencesApiTest testClass, String callId) throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + + try { + testClass.Basic.setUsername(BW_USERNAME); + testClass.Basic.setPassword(BW_PASSWORD); + + String callState = testClass.callsApi.getCallState(BW_ACCOUNT_ID, callId).getState(); + if (!callState.equalsIgnoreCase("disconnected")) { + UpdateCall updateCallBody = new UpdateCall(); + updateCallBody.setState(CallStateEnum.COMPLETED); + ApiResponse response = testClass.callsApi.updateCallWithHttpInfo(BW_ACCOUNT_ID, + callId, + updateCallBody); + } + } catch (ApiException e) { + System.out.println("API Error: " + e.toString()); + throw new Exception("Failed to terminate all calls: [" + callId + "]"); + } + } + + public static final void Cleanup(RecordingsApiTest testClass, String callId) throws Exception { + TimeUnit.SECONDS.sleep(TEST_SLEEP); + + try { + testClass.Basic.setUsername(BW_USERNAME); + testClass.Basic.setPassword(BW_PASSWORD); + + String callState = testClass.callsApi.getCallState(BW_ACCOUNT_ID, callId).getState(); + if (!callState.equalsIgnoreCase("disconnected")) { + UpdateCall updateCallBody = new UpdateCall(); + updateCallBody.setState(CallStateEnum.COMPLETED); + ApiResponse response = testClass.callsApi.updateCallWithHttpInfo(BW_ACCOUNT_ID, + callId, + updateCallBody); + } + } catch (ApiException e) { + System.out.println("API Error: " + e.toString()); + throw new Exception("Failed to terminate all calls: [" + callId + "]"); + } + } +} diff --git a/src/test/java/com/bandwidth/sdk/utils/MantecaStatusResponse.java b/src/test/java/com/bandwidth/sdk/utils/MantecaStatusResponse.java new file mode 100644 index 00000000..29eb3ede --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/utils/MantecaStatusResponse.java @@ -0,0 +1,12 @@ +package com.bandwidth.sdk.utils; + +public class MantecaStatusResponse { + public Boolean callRecorded; + public Boolean callTranscribed; + + public MantecaStatusResponse(Boolean callRecorded, Boolean callTranscribed) { + this.callRecorded = callRecorded; + this.callTranscribed = callTranscribed; + } + +} diff --git a/src/test/java/com/bandwidth/sdk/utils/TestingEnvironmentVariables.java b/src/test/java/com/bandwidth/sdk/utils/TestingEnvironmentVariables.java new file mode 100644 index 00000000..d7f22105 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/utils/TestingEnvironmentVariables.java @@ -0,0 +1,27 @@ +package com.bandwidth.sdk.utils; + +public final class TestingEnvironmentVariables { + public static final String BW_USERNAME = System.getenv("BW_USERNAME"); + public static final String BW_PASSWORD = System.getenv("BW_PASSWORD"); + public static final String BW_ACCOUNT_ID = System.getenv("BW_ACCOUNT_ID"); + public static final String BW_MESSAGING_APPLICATION_ID = System.getenv("BW_MESSAGING_APPLICATION_ID"); + public static final String BW_VOICE_APPLICATION_ID = System.getenv("BW_VOICE_APPLICATION_ID"); + public static final String BASE_CALLBACK_URL = System.getenv("BASE_CALLBACK_URL"); + public static final String BW_NUMBER_PROVIDER = System.getenv("BW_NUMBER_PROVIDER"); + public static final String BW_NUMBER = System.getenv("BW_NUMBER"); + public static final String VZW_NUMBER = System.getenv("VZW_NUMBER"); + public static final String ATT_NUMBER = System.getenv("ATT_NUMBER"); + public static final String T_MOBILE_NUMBER = System.getenv("T_MOBILE_NUMBER"); + public static final String USER_NUMBER = System.getenv("USER_NUMBER"); + public static final String FORBIDDEN_USERNAME = System.getenv("BW_USERNAME_FORBIDDEN"); + public static final String FORBIDDEN_PASSWORD = System.getenv("BW_PASSWORD_FORBIDDEN"); + public static final String MANTECA_ACTIVE_NUMBER = System.getenv("MANTECA_ACTIVE_NUMBER"); + public static final String MANTECA_IDLE_NUMBER = System.getenv("MANTECA_IDLE_NUMBER"); + public static final String MANTECA_BASE_URL = System.getenv("MANTECA_BASE_URL"); + public static final String MANTECA_STATUS_URL = MANTECA_BASE_URL + "/tests/"; + public static final String MANTECA_APPLICATION_ID = System.getenv("MANTECA_APPLICATION_ID"); + public static final String JAVA_VERSION = System.getenv("JAVA_VERSION"); + public static final String OPERATING_SYSTEM = System.getenv("OPERATING_SYSTEM"); + public static final String DISTRIBUTION = System.getenv("DISTRIBUTION"); + public static final String RUNNER_OS = System.getenv("RUNNER_OS"); +} diff --git a/src/test/resources/mediaUpload.png b/src/test/resources/mediaUpload.png deleted file mode 100644 index a30885fc..00000000 Binary files a/src/test/resources/mediaUpload.png and /dev/null differ